PdfDraw: Refactored sythetised italic and bold

git-svn-id: svn://ultimatepp.org/upp/trunk@5594 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-11-29 19:46:46 +00:00
parent c67ab5a145
commit 735c6e4b42
4 changed files with 169 additions and 157 deletions

View file

@ -0,0 +1,94 @@
static const char ICC_ColorSpaceInfo[] =
"H\211\234\226yTSw\026\307\177o\311\236\220\225\260\303c\r[\200\260\006\2205la\221"
"\035\004Q\bI\b\001\022BH\330\005AD\005\024ED\204\252\2252\326mtFOE\235.\256c\255\016"
"\326}\352\322\003\3650\352\3508\264\026\327\216\235\0278G\235Ng\246\323\357\037\357"
"\3679\367w\357\357\335\337\275\367\235\363\000\240'\245\252\265\3250\v\000\215\326"
"\240\317J\214\305\026\025\024b\244\t\000\003\n \002\021\0002y\255.-;!\a\340\222\306"
"K\260Z\334\t\374\213\236^\a\220i\275\"L\312\3000\360\377\211-\327\351\r\000@\0318"
"\a(\224\265r\234;q\256\2527\350L\366\031\234y\245\225&\206Q\023\353\361\004q\2664"
"\261j\236\275\347|\3469\332\304\n\215V\201\263)g\235B\2430\361i\234W\327\031\2258"
"#\2518w\325\251\225\3658_\305\331\245\312\250Q\343\374\334\024\253Q\312j\001@\351"
"&\273A)/\307\331\017g\272>'K\202\363\002\000\310t\325;\\\372\016\033\224\r\006\323"
"\245$\325\272F\275ZUn\300\334\345\036\230(4T\214%)\353\253\224\006\2030C&\257\224"
"\351\025\230\244Z\243\223i\033\001\230\277\363\2348\246\332bx\221\203E\241\301\301"
"B\177\037\321;\205\372\257\233\277P\246\336\316\323\223\314\271\236A\374\vom?\347"
"W=\n\200x\026\257\315\372\267\266\322-\000\214\257\004\300\362\346[\233\313\373\000"
"0\361\276\035\276\370\316}\370\246y)7\030ta\276\276\365\365\365>j\245\334\307T\320"
"7\372\237\016\277@\357\274\317\307t\334\233\362`q\3122\231\261\312\200\231\352&\257"
"\256\2526\352\261Z\235L\256\304\204?\035\342_\035\370\363yxg)\313\224z\245\026\217"
"\310\303\247L\255U\341\355\326*\324\006u\265\026Sk\377S\023\177e\330O4?\327\270\270"
"c\257\001\257\330\a\260.\362\000\362\267\v\000\345\322\000R\264\r\337\201\336\364"
"-\225\222\a2\3605\337\341\336\374\334\317\t\372\367S\341>\323\243V\255\232\213\223"
"d\345`r\243\276n~\317\364Y\002\002\240\002&\340\001+`\017\234\201;\020\002\177\020"
"\002\302A4\210\a\311 \035\344\200\002\260\024\310A9\320\000=\250\a-\240\035t\201\036"
"\260\036l\002\303`;\030\003\273\301~p\020\214\203\217\301\t\360Gp\036|\t\256\201["
"`\022L\203\207`\006<\005\257 \b\"A\f\210\vYA\016\220+\344\005\371Cb(\022\212\207R"
"\241,\250\000*\201T\220\0262B-\320\n\250\a\352\207\206\241\035\320n\350\367\320Q\350"
"\004t\016\272\004}\005MA\017\240\357\240\2270\002\323a\036l\a\273\301\276\260\030"
"\216\201S\340\034x\t\254\202k\340&\270\023^\a\017\301\243\360>\3700|\002>\017_\203"
"'\341\207\360,\002\020\032\302G\034\021!\"F$H:R\210\224!z\244\025\351F\006\221Qd?"
"r\f9\213\\A&\221G\310\v\224\210rQ\f\025\242\341h\022\232\213\312\321\032\264\025\355"
"E\207\321]\350a\3644z\005\235Bg\320\327\004\006\301\226\340E\b#H\t\213\b*B=\241\213"
"0H\330I\370\210p\206p\2150MxJ$\022\371D\0011\204\230D, V\020\233\211\275\304\255\304"
"\003\304\343\304K\304\273\304Y\022\211dE\362\"E\220\322I2\222\201\324E\332B\332G\372"
"\214t\2314MzN\246\221\035\310\376\344\004r!YK\356 \017\222\367\220?%_&\337#\277\242"
"\260(\256\2240J:EAi\244\364Q\306(\307(\027)\323\224WT6U@\215\240\346P+\250\355\324"
"!\352~\352\031\352m\352\023\032\215\346D\v\245e\322\324\264\345\264!\332\357h\237"
"\323\246h/\350\034\272']B/\242\033\351\353\350\037\322\217\323\277\242?a0\030n\214"
"hF!\303\300X\307\330\3158\305\370\232\361\334\214k\346c&5S\230\265\231\215\230\035"
"6\273l\366\230Ia\2722c\230K\231M\314A\346!\346E\346#\026\205\345\306\222\260d\254"
"V\326\b\353(\353\006k\226\315e\213\330\351l\r\273\227\275\207}\216}\237C\342\270q"
"\3429\nN'\347\003\316)\316].\302u\346J\270r\356\n\356\030\367\fw\232G\344\txR^\005"
"\257\207\367[\336\004o\306\234c\036h\236g\336`>b\376\211\371$\037\341\273\361\245"
"\374*~\037\377 \377:\377\245\205\235E\214\205\322b\215\305~\213\313\026\317,m,\243"
"-\225\226\335\226\a,\257Y\276\264\302\254\342\255*\2556X\215[\335\261F\255=\2553\255"
"\353\255\267Y\237\261~d\303\263\t\267\221\333t\333\034\264\271i\v\333z\332f\3316\333"
"~`{\301v\326\316\336.\321Ng\267\305\356\224\335#{\276}\264}\205\375\200\375\247\366"
"\017\034\270\016\221\016j\207\001\207\317\034\376\212\231c1X\0256\204\235\306f\034"
"m\035\223\034\215\216;\034'\034_9\t\234r\235:\234\0168\335q\246:\213\235\313\234\a"
"\234O:\317\2708\270\244\271\264\270\354u\271\351Jq\025\273\226\273nv=\353\372\314"
"M\340\226\357\266\312m\334\355\276\300R \0254\t\366\nn\2733\334\243\334k\334G\335"
"\257z\020=\304\036\225\036[=\276\364\204=\203<\313=G</z\301^\301^j\257\255^\227\274"
"\t\336\241\336Z\357Q\357\033B\2720FX'\334+\234\362\341\373\244\372t\370\214\373<\366"
"u\361-\364\335\340{\326\367\265_\220_\225\337\230\337-\021G\224,\352\020\035\023}"
"\347\357\351/\367\037\361\277\032\300\bH\bh\v8\022\360m\240W\2402p[\340\237\203\270"
"AiA\253\202N\006\375#8$X\037\274?\370A\210KHI\310{!7\304<q\206\270W\374y(!46\264-"
"\364\343\320\027a\301a\206\260\203a\177\017\027\206W\206\357\t\277\277@\260@\271`"
"l\301\335\b\247\bY\304\216\210\311H,\262$\362\375\310\311(\307(Y\324h\3247\321\316"
"\321\212\350\235\321\367b<b*b\366\305<\216\365\213\325\307~\024\373L\022&Y&9\036\207"
"\304%\306u\307M\304s\342s\343\207\343\277NpJP%\354M\230I\fJlN<\236DHJI\332\220tCj"
"'\225KwKg\222C\222\227%\237N\241\247d\247\f\247|\223\352\231\252O=\226\006\247%\247"
"mL\273\275\320u\241v\341x:H\227\246oL\277\223!\310\250\311\370C&13#s$\363/Y\242\254"
"\226\254\263\331\334\354\342\354=\331Osbs\372rn\345\272\347\032sO\3461\363\212\362"
"v\347=\313\217\313\357\317\237\\\344\273h\331\242\363\005\326\005\352\202#\205\244"
"\302\274\302\235\205\263\213\343\027oZ<]\024T\324Ut}\211`I\303\222sK\255\227V-\375"
"\244\230Y,+>TB(\311/\331S\362\203,]6*\233-\225\226\276W:#\227\3107\313\037*\242\025"
"\003\212\a\312\be\277\362^YDY\177\331}U\204j\243\352AyT\371`\371#\265D=\254\376\266"
"\"\251b{\305\263\312\364\312\017+\177\254\312\257:\240!kJ4G\265\034m\245\366t\265"
"}uC\365%\235\227\256K7Y\023V\263\251fF\237\242\337Y\v\325.\251=b\340\341?S\027\214"
"\356\306\225\306\251\272\310\272\221\272\347\365y\365\207\032\330\r\332\206\v\215"
"\236\215k\032\3575%4\375\246\031m\2267\237lqlio\231Z\026\263lG+\324Z\332z\262\315"
"\271\255\263mzy\342\362]\355\324\366\312\366?u\370u\364w|\277\"\177\305\261N\273\316"
"\345\235wW&\256\334\333e\326\245\357\272\261*|\325\366\325\350j\365\352\2115\001k"
"\266\254y\335\255\350\376\242\307\257g\260\347\207^y\357\027kEk\207\326\376\270\256"
"l\335D_p\337\266\365\304\365\332\365\3277Dm\330\325\317\356o\352\277\2731m\343\341"
"\001l\240{\340\373M\305\233\316\r\006\016n\337L\335l\334<9\224\372O\000\244\001[\376"
"\230\270\231$\231\220\231\374\232h\232\325\233B\233\257\234\034\234\211\234\367\235"
"d\235\322\236@\236\256\237\035\237\213\237\372\240i\240\330\241G\241\266\242&\242"
"\226\243\006\243v\243\346\244V\244\307\2458\245\251\246\032\246\213\246\375\247n\247"
"\340\250R\250\304\2517\251\251\252\034\252\217\253\002\253u\253\351\254\\\254\320"
"\255D\255\270\256-\256\241\257\026\257\213\260\000\260u\260\352\261`\261\326\262K"
"\262\302\2638\263\256\264%\264\234\265\023\265\212\266\001\266y\266\360\267h\267\340"
"\270Y\270\321\271J\271\302\272;\272\265\273.\273\247\274!\274\233\275\025\275\217"
"\276\n\276\204\276\377\277z\277\365\300p\300\354\301g\301\343\302_\302\333\303X\303"
"\324\304Q\304\316\305K\305\310\306F\306\303\307A\307\277\310=\310\274\311:\311\271"
"\3128\312\267\3136\313\266\3145\314\265\3155\315\265\3166\316\266\3177\317\270\320"
"9\320\272\321<\321\276\322?\322\301\323D\323\306\324I\324\313\325N\325\321\326U\326"
"\330\327\\\327\340\330d\330\350\331l\331\361\332v\332\373\333\200\334\005\334\212"
"\335\020\335\226\336\034\336\242\337)\337\257\3406\340\275\341D\341\314\342S\342\333"
"\343c\343\353\344s\344\374\345\204\346\r\346\226\347\037\347\251\3502\350\274\351"
"F\351\320\352[\352\345\353p\353\373\354\206\355\021\355\234\356(\356\264\357@\357"
"\314\360X\360\345\361r\361\377\362\214\363\031\363\247\3644\364\302\365P\365\336\366"
"m\366\373\367\212\370\031\370\250\3718\371\307\372W\372\347\373w\374\a\374\230\375"
")\375\272\376K\376\334\377m\377\377\002\f\000\367\204\363\373";

View file

@ -2,105 +2,13 @@
NAMESPACE_UPP
#include "ICCColorSpace.i"
#define LDUMP(x) // DUMP(x)
#define LLOG(x) // LOG(x)
#define PDF_COMPRESS
static const char ICC_ColorSpaceInfo[] =
"H\211\234\226yTSw\026\307\177o\311\236\220\225\260\303c\r[\200\260\006\2205la\221"
"\035\004Q\bI\b\001\022BH\330\005AD\005\024ED\204\252\2252\326mtFOE\235.\256c\255\016"
"\326}\352\322\003\3650\352\3508\264\026\327\216\235\0278G\235Ng\246\323\357\037\357"
"\3679\367w\357\357\335\337\275\367\235\363\000\240'\245\252\265\3250\v\000\215\326"
"\240\317J\214\305\026\025\024b\244\t\000\003\n \002\021\0002y\255.-;!\a\340\222\306"
"K\260Z\334\t\374\213\236^\a\220i\275\"L\312\3000\360\377\211-\327\351\r\000@\0318"
"\a(\224\265r\234;q\256\2527\350L\366\031\234y\245\225&\206Q\023\353\361\004q\2664"
"\261j\236\275\347|\3469\332\304\n\215V\201\263)g\235B\2430\361i\234W\327\031\2258"
"#\2518w\325\251\225\3658_\305\331\245\312\250Q\343\374\334\024\253Q\312j\001@\351"
"&\273A)/\307\331\017g\272>'K\202\363\002\000\310t\325;\\\372\016\033\224\r\006\323"
"\245$\325\272F\275ZUn\300\334\345\036\230(4T\214%)\353\253\224\006\2030C&\257\224"
"\351\025\230\244Z\243\223i\033\001\230\277\363\2348\246\332bx\221\203E\241\301\301"
"B\177\037\321;\205\372\257\233\277P\246\336\316\323\223\314\271\236A\374\vom?\347"
"W=\n\200x\026\257\315\372\267\266\322-\000\214\257\004\300\362\346[\233\313\373\000"
"0\361\276\035\276\370\316}\370\246y)7\030ta\276\276\365\365\365>j\245\334\307T\320"
"7\372\237\016\277@\357\274\317\307t\334\233\362`q\3122\231\261\312\200\231\352&\257"
"\256\2526\352\261Z\235L\256\304\204?\035\342_\035\370\363yxg)\313\224z\245\026\217"
"\310\303\247L\255U\341\355\326*\324\006u\265\026Sk\377S\023\177e\330O4?\327\270\270"
"c\257\001\257\330\a\260.\362\000\362\267\v\000\345\322\000R\264\r\337\201\336\364"
"-\225\222\a2\3605\337\341\336\374\334\317\t\372\367S\341>\323\243V\255\232\213\223"
"d\345`r\243\276n~\317\364Y\002\002\240\002&\340\001+`\017\234\201;\020\002\177\020"
"\002\302A4\210\a\311 \035\344\200\002\260\024\310A9\320\000=\250\a-\240\035t\201\036"
"\260\036l\002\303`;\030\003\273\301~p\020\214\203\217\301\t\360Gp\036|\t\256\201["
"`\022L\203\207`\006<\005\257 \b\"A\f\210\vYA\016\220+\344\005\371Cb(\022\212\207R"
"\241,\250\000*\201T\220\0262B-\320\n\250\a\352\207\206\241\035\320n\350\367\320Q\350"
"\004t\016\272\004}\005MA\017\240\357\240\2270\002\323a\036l\a\273\301\276\260\030"
"\216\201S\340\034x\t\254\202k\340&\270\023^\a\017\301\243\360>\3700|\002>\017_\203"
"'\341\207\360,\002\020\032\302G\034\021!\"F$H:R\210\224!z\244\025\351F\006\221Qd?"
"r\f9\213\\A&\221G\310\v\224\210rQ\f\025\242\341h\022\232\213\312\321\032\264\025\355"
"E\207\321]\350a\3644z\005\235Bg\320\327\004\006\301\226\340E\b#H\t\213\b*B=\241\213"
"0H\330I\370\210p\206p\2150MxJ$\022\371D\0011\204\230D, V\020\233\211\275\304\255\304"
"\003\304\343\304K\304\273\304Y\022\211dE\362\"E\220\322I2\222\201\324E\332B\332G\372"
"\214t\2314MzN\246\221\035\310\376\344\004r!YK\356 \017\222\367\220?%_&\337#\277\242"
"\260(\256\2240J:EAi\244\364Q\306(\307(\027)\323\224WT6U@\215\240\346P+\250\355\324"
"!\352~\352\031\352m\352\023\032\215\346D\v\245e\322\324\264\345\264!\332\357h\237"
"\323\246h/\350\034\272']B/\242\033\351\353\350\037\322\217\323\277\242?a0\030n\214"
"hF!\303\300X\307\330\3158\305\370\232\361\334\214k\346c&5S\230\265\231\215\230\035"
"6\273l\366\230Ia\2722c\230K\231M\314A\346!\346E\346#\026\205\345\306\222\260d\254"
"V\326\b\353(\353\006k\226\315e\213\330\351l\r\273\227\275\207}\216}\237C\342\270q"
"\3429\nN'\347\003\316)\316].\302u\346J\270r\356\n\356\030\367\fw\232G\344\txR^\005"
"\257\207\367[\336\004o\306\234c\036h\236g\336`>b\376\211\371$\037\341\273\361\245"
"\374*~\037\377 \377:\377\245\205\235E\214\205\322b\215\305~\213\313\026\317,m,\243"
"-\225\226\335\226\a,\257Y\276\264\302\254\342\255*\2556X\215[\335\261F\255=\2553\255"
"\353\255\267Y\237\261~d\303\263\t\267\221\333t\333\034\264\271i\v\333z\332f\3316\333"
"~`{\301v\326\316\336.\321Ng\267\305\356\224\335#{\276}\264}\205\375\200\375\247\366"
"\017\034\270\016\221\016j\207\001\207\317\034\376\212\231c1X\0256\204\235\306f\034"
"m\035\223\034\215\216;\034'\034_9\t\234r\235:\234\0168\335q\246:\213\235\313\234\a"
"\234O:\317\2708\270\244\271\264\270\354u\271\351Jq\025\273\226\273nv=\353\372\314"
"M\340\226\357\266\312m\334\355\276\300R \0254\t\366\nn\2733\334\243\334k\334G\335"
"\257z\020=\304\036\225\036[=\276\364\204=\203<\313=G</z\301^\301^j\257\255^\227\274"
"\t\336\241\336Z\357Q\357\033B\2720FX'\334+\234\362\341\373\244\372t\370\214\373<\366"
"u\361-\364\335\340{\326\367\265_\220_\225\337\230\337-\021G\224,\352\020\035\023}"
"\347\357\351/\367\037\361\277\032\300\bH\bh\v8\022\360m\240W\2402p[\340\237\203\270"
"AiA\253\202N\006\375#8$X\037\274?\370A\210KHI\310{!7\304<q\206\270W\374y(!46\264-"
"\364\343\320\027a\301a\206\260\203a\177\017\027\206W\206\357\t\277\277@\260@\271`"
"l\301\335\b\247\bY\304\216\210\311H,\262$\362\375\310\311(\307(Y\324h\3247\321\316"
"\321\212\350\235\321\367b<b*b\366\305<\216\365\213\325\307~\024\373L\022&Y&9\036\207"
"\304%\306u\307M\304s\342s\343\207\343\277NpJP%\354M\230I\fJlN<\236DHJI\332\220tCj"
"'\225KwKg\222C\222\227%\237N\241\247d\247\f\247|\223\352\231\252O=\226\006\247%\247"
"mL\273\275\320u\241v\341x:H\227\246oL\277\223!\310\250\311\370C&13#s$\363/Y\242\254"
"\226\254\263\331\334\354\342\354=\331Osbs\372rn\345\272\347\032sO\3461\363\212\362"
"v\347=\313\217\313\357\317\237\\\344\273h\331\242\363\005\326\005\352\202#\205\244"
"\302\274\302\235\205\263\213\343\027oZ<]\024T\324Ut}\211`I\303\222sK\255\227V-\375"
"\244\230Y,+>TB(\311/\331S\362\203,]6*\233-\225\226\276W:#\227\3107\313\037*\242\025"
"\003\212\a\312\be\277\362^YDY\177\331}U\204j\243\352AyT\371`\371#\265D=\254\376\266"
"\"\251b{\305\263\312\364\312\017+\177\254\312\257:\240!kJ4G\265\034m\245\366t\265"
"}uC\365%\235\227\256K7Y\023V\263\251fF\237\242\337Y\v\325.\251=b\340\341?S\027\214"
"\356\306\225\306\251\272\310\272\221\272\347\365y\365\207\032\330\r\332\206\v\215"
"\236\215k\032\3575%4\375\246\031m\2267\237lqlio\231Z\026\263lG+\324Z\332z\262\315"
"\271\255\263mzy\342\362]\355\324\366\312\366?u\370u\364w|\277\"\177\305\261N\273\316"
"\345\235wW&\256\334\333e\326\245\357\272\261*|\325\366\325\350j\365\352\2115\001k"
"\266\254y\335\255\350\376\242\307\257g\260\347\207^y\357\027kEk\207\326\376\270\256"
"l\335D_p\337\266\365\304\365\332\365\3277Dm\330\325\317\356o\352\277\2731m\343\341"
"\001l\240{\340\373M\305\233\316\r\006\016n\337L\335l\334<9\224\372O\000\244\001[\376"
"\230\270\231$\231\220\231\374\232h\232\325\233B\233\257\234\034\234\211\234\367\235"
"d\235\322\236@\236\256\237\035\237\213\237\372\240i\240\330\241G\241\266\242&\242"
"\226\243\006\243v\243\346\244V\244\307\2458\245\251\246\032\246\213\246\375\247n\247"
"\340\250R\250\304\2517\251\251\252\034\252\217\253\002\253u\253\351\254\\\254\320"
"\255D\255\270\256-\256\241\257\026\257\213\260\000\260u\260\352\261`\261\326\262K"
"\262\302\2638\263\256\264%\264\234\265\023\265\212\266\001\266y\266\360\267h\267\340"
"\270Y\270\321\271J\271\302\272;\272\265\273.\273\247\274!\274\233\275\025\275\217"
"\276\n\276\204\276\377\277z\277\365\300p\300\354\301g\301\343\302_\302\333\303X\303"
"\324\304Q\304\316\305K\305\310\306F\306\303\307A\307\277\310=\310\274\311:\311\271"
"\3128\312\267\3136\313\266\3145\314\265\3155\315\265\3166\316\266\3177\317\270\320"
"9\320\272\321<\321\276\322?\322\301\323D\323\306\324I\324\313\325N\325\321\326U\326"
"\330\327\\\327\340\330d\330\350\331l\331\361\332v\332\373\333\200\334\005\334\212"
"\335\020\335\226\336\034\336\242\337)\337\257\3406\340\275\341D\341\314\342S\342\333"
"\343c\343\353\344s\344\374\345\204\346\r\346\226\347\037\347\251\3502\350\274\351"
"F\351\320\352[\352\345\353p\353\373\354\206\355\021\355\234\356(\356\264\357@\357"
"\314\360X\360\345\361r\361\377\362\214\363\031\363\247\3644\364\302\365P\365\336\366"
"m\366\373\367\212\370\031\370\250\3718\371\307\372W\372\347\373w\374\a\374\230\375"
")\375\272\376K\376\334\377m\377\377\002\f\000\367\204\363\373";
dword PdfDraw::GetInfo() const
{
return DOTS;
@ -178,15 +86,13 @@ int PdfDraw::PutStream(const String& data, const String& keys, bool compress)
void PdfDraw::PutrgColor(Color rg, uint64 pattern)
{
if(IsNull(rgcolor) || rg != rgcolor || pattern != patternid) {
if(!pattern) {
if(!pattern)
page << PdfColor(rg) << " rg\n";
}
else {
int f = patterns.FindAdd(pattern);
if(!patternid)
page << "/Cspat cs\n";
page << PdfColor(rg) <<
" /Pat" << (f + 1) << " scn\n";
page << PdfColor(rg) << " /Pat" << (f + 1) << " scn\n";
}
}
@ -356,7 +262,8 @@ PdfDraw::OutlineInfo PdfDraw::GetOutlineInfo(Font fnt)
TTFReader ttf;
if(ttf.Open(fnt.GetData(), false, true)) {
of.ttf = true;
of.sitalic = ttf.post.italicAngle == 0 && fnt.IsItalic();
of.sitalic = fnt.IsItalic() && (ttf.head.macStyle & 2) == 0;
of.sbold = fnt.IsBold() && (ttf.head.macStyle & 1) == 0;
}
outline_info.Add(fnt, of);
@ -380,69 +287,78 @@ void PdfDraw::DrawTextOp(int x, int y, int angle, const wchar *s, Font fnt,
String txt;
PutrgColor(ink);
PutRGColor(ink);
page << "BT ";
double sina = 0, cosa = 1;
if(angle)
Draw::SinCos(angle, sina, cosa);
int nbld = 0;
int sbld = 1;
if(of.sbold) {
nbld = abs(ff.GetHeight()) / 30;
sbld = min(5, nbld);
}
int posx = 0;
if(angle || dx || (of.sitalic && !fnt.IsItalic())) {
M22 m;
if(of.sitalic)
m.c = 0.165;
if(angle) {
Draw::SinCos(angle, sina, cosa);
m.Mul(cosa, sina, -sina, cosa);
}
int fi = -1;
bool straight = (fabs(m.a - 1) <= 1e-8 && fabs(m.b) <= 1e-8 && fabs(m.c) <= 1e-8 && fabs(m.d - 1) <= 1e-8);
Pointf prev(0, 0);
for(int i = 0; i < n; i++) {
Pointf next(Pt(x + posx * cosa + fround(ff.GetAscent() * sina)),
Pt(pgsz.cy - (y - posx * sina) - fround(ff.GetAscent() * cosa)));
CharPos fp = GetCharPos(fnt, s[i]);
if(fi != fp.fi) {
fi = fp.fi;
PutFontHeight(fi, fh);
for(int q = 0; q <= nbld; q += sbld) {
page << "BT ";
posx = q;
if(angle || dx || of.sitalic) {
M22 m;
if(of.sitalic)
m.c = 0.165;
if(angle)
m.Mul(cosa, sina, -sina, cosa);
int fi = -1;
bool straight = (fabs(m.a - 1) <= 1e-8 && fabs(m.b) <= 1e-8 && fabs(m.c) <= 1e-8 && fabs(m.d - 1) <= 1e-8);
Pointf prev(0, 0);
for(int i = 0; i < n; i++) {
Pointf next(Pt(x + posx * cosa + fround(ff.GetAscent() * sina)),
Pt(pgsz.cy - (y - posx * sina) - fround(ff.GetAscent() * cosa)));
CharPos fp = GetCharPos(fnt, s[i]);
if(fi != fp.fi) {
fi = fp.fi;
PutFontHeight(fi, fh);
}
if(straight)
page << (next.x - prev.x) << ' ' << (next.y - prev.y) << " Td";
else
page << m.a << ' ' << m.b << ' ' << m.c << ' ' << m.d << ' ' << next.x << ' ' << next.y << " Tm";
page << " <" << FormatIntHex(fp.ci, 2);
while(i + 1 < n) {
int cw = ff[s[i]];
if(dx && dx[i] != cw)
break;
posx += cw;
CharPos np = GetCharPos(fnt, s[i + 1]);
if(np.fi != fp.fi)
break;
page << FormatIntHex(np.ci, 2);
i++;
}
page << "> Tj\n";
posx += dx ? dx[i] : ff[s[i]];
prev = next;
}
if(straight)
page << (next.x - prev.x) << ' ' << (next.y - prev.y) << " Td";
else
page << m.a << ' ' << m.b << ' ' << m.c << ' ' << m.d << ' ' << next.x << ' ' << next.y << " Tm";
page << " <" << FormatIntHex(fp.ci, 2);
while(i + 1 < n) {
int cw = ff[s[i]];
if(dx && dx[i] != cw)
break;
posx += cw;
CharPos np = GetCharPos(fnt, s[i + 1]);
if(np.fi != fp.fi)
break;
page << FormatIntHex(np.ci, 2);
i++;
}
page << "> Tj\n";
posx += dx ? dx[i] : ff[s[i]];
prev = next;
}
else {
page << Pt(x + q) << " " << Pt(pgsz.cy - y - ff.GetAscent()) << " Td\n";
int fi = -1;
int ppos = 0;
int np = 0;
for(int i = 0; i < n; i++) {
CharPos fp = GetCharPos(fnt, s[i]);
if(fp.fi != fi) {
FlushText(np, fi, fnt.GetHeight(), txt);
txt.Clear();
np = posx - ppos;
ppos = posx;
fi = fp.fi;
}
txt.Cat(Sprintf("%02.2X", fp.ci));
posx += ff[s[i]];
}
FlushText(np, fi, fh, txt);
}
page << "ET\n";
}
else {
page << Pt(x) << " " << Pt(pgsz.cy - y - ff.GetAscent()) << " Td\n";
int fi = -1;
int ppos = 0;
int np = 0;
for(int i = 0; i < n; i++) {
CharPos fp = GetCharPos(fnt, s[i]);
if(fp.fi != fi) {
FlushText(np, fi, fnt.GetHeight(), txt);
txt.Clear();
np = posx - ppos;
ppos = posx;
fi = fp.fi;
}
txt.Cat(Sprintf("%02.2X", fp.ci));
posx += ff[s[i]];
}
FlushText(np, fi, fh, txt);
}
page << "ET\n";
if(fnt.IsUnderline()) {
int w = ff.GetAscent() / 15;
int dy = ff.GetAscent() + max((ff.GetDescent() - w) / 2, ff.GetAscent() / 10);

View file

@ -264,6 +264,7 @@ private:
struct OutlineInfo : Moveable<OutlineInfo> {
bool ttf;
bool sitalic;
bool sbold;
};
VectorMap<Font, OutlineInfo> outline_info;

View file

@ -9,6 +9,7 @@ file
TTFStruct.cpp,
TTFReader.cpp,
TTFSubset.cpp,
ICCColorSpace.i,
PdfDraw.cpp,
PdfReport.icpp,
Info readonly separator,