Fix File
•
/
home
/
sportsfe...
/
httpdocs
/
wp-conte...
/
plugins
/
embedpre...
/
assets
/
pdf
/
build
•
File:
pdf.worker.js
•
Content:
t.udeva = 0x0909; t.udieresis = 0x00fc; t.udieresisacute = 0x01d8; t.udieresisbelow = 0x1e73; t.udieresiscaron = 0x01da; t.udieresiscyrillic = 0x04f1; t.udieresisgrave = 0x01dc; t.udieresismacron = 0x01d6; t.udotbelow = 0x1ee5; t.ugrave = 0x00f9; t.ugujarati = 0x0a89; t.ugurmukhi = 0x0a09; t.uhiragana = 0x3046; t.uhookabove = 0x1ee7; t.uhorn = 0x01b0; t.uhornacute = 0x1ee9; t.uhorndotbelow = 0x1ef1; t.uhorngrave = 0x1eeb; t.uhornhookabove = 0x1eed; t.uhorntilde = 0x1eef; t.uhungarumlaut = 0x0171; t.uhungarumlautcyrillic = 0x04f3; t.uinvertedbreve = 0x0217; t.ukatakana = 0x30a6; t.ukatakanahalfwidth = 0xff73; t.ukcyrillic = 0x0479; t.ukorean = 0x315c; t.umacron = 0x016b; t.umacroncyrillic = 0x04ef; t.umacrondieresis = 0x1e7b; t.umatragurmukhi = 0x0a41; t.umonospace = 0xff55; t.underscore = 0x005f; t.underscoredbl = 0x2017; t.underscoremonospace = 0xff3f; t.underscorevertical = 0xfe33; t.underscorewavy = 0xfe4f; t.union = 0x222a; t.universal = 0x2200; t.uogonek = 0x0173; t.uparen = 0x24b0; t.upblock = 0x2580; t.upperdothebrew = 0x05c4; t.upsilon = 0x03c5; t.upsilondieresis = 0x03cb; t.upsilondieresistonos = 0x03b0; t.upsilonlatin = 0x028a; t.upsilontonos = 0x03cd; t.uptackbelowcmb = 0x031d; t.uptackmod = 0x02d4; t.uragurmukhi = 0x0a73; t.uring = 0x016f; t.ushortcyrillic = 0x045e; t.usmallhiragana = 0x3045; t.usmallkatakana = 0x30a5; t.usmallkatakanahalfwidth = 0xff69; t.ustraightcyrillic = 0x04af; t.ustraightstrokecyrillic = 0x04b1; t.utilde = 0x0169; t.utildeacute = 0x1e79; t.utildebelow = 0x1e75; t.uubengali = 0x098a; t.uudeva = 0x090a; t.uugujarati = 0x0a8a; t.uugurmukhi = 0x0a0a; t.uumatragurmukhi = 0x0a42; t.uuvowelsignbengali = 0x09c2; t.uuvowelsigndeva = 0x0942; t.uuvowelsigngujarati = 0x0ac2; t.uvowelsignbengali = 0x09c1; t.uvowelsigndeva = 0x0941; t.uvowelsigngujarati = 0x0ac1; t.v = 0x0076; t.vadeva = 0x0935; t.vagujarati = 0x0ab5; t.vagurmukhi = 0x0a35; t.vakatakana = 0x30f7; t.vav = 0x05d5; t.vavdagesh = 0xfb35; t.vavdagesh65 = 0xfb35; t.vavdageshhebrew = 0xfb35; t.vavhebrew = 0x05d5; t.vavholam = 0xfb4b; t.vavholamhebrew = 0xfb4b; t.vavvavhebrew = 0x05f0; t.vavyodhebrew = 0x05f1; t.vcircle = 0x24e5; t.vdotbelow = 0x1e7f; t.vecyrillic = 0x0432; t.veharabic = 0x06a4; t.vehfinalarabic = 0xfb6b; t.vehinitialarabic = 0xfb6c; t.vehmedialarabic = 0xfb6d; t.vekatakana = 0x30f9; t.venus = 0x2640; t.verticalbar = 0x007c; t.verticallineabovecmb = 0x030d; t.verticallinebelowcmb = 0x0329; t.verticallinelowmod = 0x02cc; t.verticallinemod = 0x02c8; t.vewarmenian = 0x057e; t.vhook = 0x028b; t.vikatakana = 0x30f8; t.viramabengali = 0x09cd; t.viramadeva = 0x094d; t.viramagujarati = 0x0acd; t.visargabengali = 0x0983; t.visargadeva = 0x0903; t.visargagujarati = 0x0a83; t.vmonospace = 0xff56; t.voarmenian = 0x0578; t.voicediterationhiragana = 0x309e; t.voicediterationkatakana = 0x30fe; t.voicedmarkkana = 0x309b; t.voicedmarkkanahalfwidth = 0xff9e; t.vokatakana = 0x30fa; t.vparen = 0x24b1; t.vtilde = 0x1e7d; t.vturned = 0x028c; t.vuhiragana = 0x3094; t.vukatakana = 0x30f4; t.w = 0x0077; t.wacute = 0x1e83; t.waekorean = 0x3159; t.wahiragana = 0x308f; t.wakatakana = 0x30ef; t.wakatakanahalfwidth = 0xff9c; t.wakorean = 0x3158; t.wasmallhiragana = 0x308e; t.wasmallkatakana = 0x30ee; t.wattosquare = 0x3357; t.wavedash = 0x301c; t.wavyunderscorevertical = 0xfe34; t.wawarabic = 0x0648; t.wawfinalarabic = 0xfeee; t.wawhamzaabovearabic = 0x0624; t.wawhamzaabovefinalarabic = 0xfe86; t.wbsquare = 0x33dd; t.wcircle = 0x24e6; t.wcircumflex = 0x0175; t.wdieresis = 0x1e85; t.wdotaccent = 0x1e87; t.wdotbelow = 0x1e89; t.wehiragana = 0x3091; t.weierstrass = 0x2118; t.wekatakana = 0x30f1; t.wekorean = 0x315e; t.weokorean = 0x315d; t.wgrave = 0x1e81; t.whitebullet = 0x25e6; t.whitecircle = 0x25cb; t.whitecircleinverse = 0x25d9; t.whitecornerbracketleft = 0x300e; t.whitecornerbracketleftvertical = 0xfe43; t.whitecornerbracketright = 0x300f; t.whitecornerbracketrightvertical = 0xfe44; t.whitediamond = 0x25c7; t.whitediamondcontainingblacksmalldiamond = 0x25c8; t.whitedownpointingsmalltriangle = 0x25bf; t.whitedownpointingtriangle = 0x25bd; t.whiteleftpointingsmalltriangle = 0x25c3; t.whiteleftpointingtriangle = 0x25c1; t.whitelenticularbracketleft = 0x3016; t.whitelenticularbracketright = 0x3017; t.whiterightpointingsmalltriangle = 0x25b9; t.whiterightpointingtriangle = 0x25b7; t.whitesmallsquare = 0x25ab; t.whitesmilingface = 0x263a; t.whitesquare = 0x25a1; t.whitestar = 0x2606; t.whitetelephone = 0x260f; t.whitetortoiseshellbracketleft = 0x3018; t.whitetortoiseshellbracketright = 0x3019; t.whiteuppointingsmalltriangle = 0x25b5; t.whiteuppointingtriangle = 0x25b3; t.wihiragana = 0x3090; t.wikatakana = 0x30f0; t.wikorean = 0x315f; t.wmonospace = 0xff57; t.wohiragana = 0x3092; t.wokatakana = 0x30f2; t.wokatakanahalfwidth = 0xff66; t.won = 0x20a9; t.wonmonospace = 0xffe6; t.wowaenthai = 0x0e27; t.wparen = 0x24b2; t.wring = 0x1e98; t.wsuperior = 0x02b7; t.wturned = 0x028d; t.wynn = 0x01bf; t.x = 0x0078; t.xabovecmb = 0x033d; t.xbopomofo = 0x3112; t.xcircle = 0x24e7; t.xdieresis = 0x1e8d; t.xdotaccent = 0x1e8b; t.xeharmenian = 0x056d; t.xi = 0x03be; t.xmonospace = 0xff58; t.xparen = 0x24b3; t.xsuperior = 0x02e3; t.y = 0x0079; t.yaadosquare = 0x334e; t.yabengali = 0x09af; t.yacute = 0x00fd; t.yadeva = 0x092f; t.yaekorean = 0x3152; t.yagujarati = 0x0aaf; t.yagurmukhi = 0x0a2f; t.yahiragana = 0x3084; t.yakatakana = 0x30e4; t.yakatakanahalfwidth = 0xff94; t.yakorean = 0x3151; t.yamakkanthai = 0x0e4e; t.yasmallhiragana = 0x3083; t.yasmallkatakana = 0x30e3; t.yasmallkatakanahalfwidth = 0xff6c; t.yatcyrillic = 0x0463; t.ycircle = 0x24e8; t.ycircumflex = 0x0177; t.ydieresis = 0x00ff; t.ydotaccent = 0x1e8f; t.ydotbelow = 0x1ef5; t.yeharabic = 0x064a; t.yehbarreearabic = 0x06d2; t.yehbarreefinalarabic = 0xfbaf; t.yehfinalarabic = 0xfef2; t.yehhamzaabovearabic = 0x0626; t.yehhamzaabovefinalarabic = 0xfe8a; t.yehhamzaaboveinitialarabic = 0xfe8b; t.yehhamzaabovemedialarabic = 0xfe8c; t.yehinitialarabic = 0xfef3; t.yehmedialarabic = 0xfef4; t.yehmeeminitialarabic = 0xfcdd; t.yehmeemisolatedarabic = 0xfc58; t.yehnoonfinalarabic = 0xfc94; t.yehthreedotsbelowarabic = 0x06d1; t.yekorean = 0x3156; t.yen = 0x00a5; t.yenmonospace = 0xffe5; t.yeokorean = 0x3155; t.yeorinhieuhkorean = 0x3186; t.yerahbenyomohebrew = 0x05aa; t.yerahbenyomolefthebrew = 0x05aa; t.yericyrillic = 0x044b; t.yerudieresiscyrillic = 0x04f9; t.yesieungkorean = 0x3181; t.yesieungpansioskorean = 0x3183; t.yesieungsioskorean = 0x3182; t.yetivhebrew = 0x059a; t.ygrave = 0x1ef3; t.yhook = 0x01b4; t.yhookabove = 0x1ef7; t.yiarmenian = 0x0575; t.yicyrillic = 0x0457; t.yikorean = 0x3162; t.yinyang = 0x262f; t.yiwnarmenian = 0x0582; t.ymonospace = 0xff59; t.yod = 0x05d9; t.yoddagesh = 0xfb39; t.yoddageshhebrew = 0xfb39; t.yodhebrew = 0x05d9; t.yodyodhebrew = 0x05f2; t.yodyodpatahhebrew = 0xfb1f; t.yohiragana = 0x3088; t.yoikorean = 0x3189; t.yokatakana = 0x30e8; t.yokatakanahalfwidth = 0xff96; t.yokorean = 0x315b; t.yosmallhiragana = 0x3087; t.yosmallkatakana = 0x30e7; t.yosmallkatakanahalfwidth = 0xff6e; t.yotgreek = 0x03f3; t.yoyaekorean = 0x3188; t.yoyakorean = 0x3187; t.yoyakthai = 0x0e22; t.yoyingthai = 0x0e0d; t.yparen = 0x24b4; t.ypogegrammeni = 0x037a; t.ypogegrammenigreekcmb = 0x0345; t.yr = 0x01a6; t.yring = 0x1e99; t.ysuperior = 0x02b8; t.ytilde = 0x1ef9; t.yturned = 0x028e; t.yuhiragana = 0x3086; t.yuikorean = 0x318c; t.yukatakana = 0x30e6; t.yukatakanahalfwidth = 0xff95; t.yukorean = 0x3160; t.yusbigcyrillic = 0x046b; t.yusbigiotifiedcyrillic = 0x046d; t.yuslittlecyrillic = 0x0467; t.yuslittleiotifiedcyrillic = 0x0469; t.yusmallhiragana = 0x3085; t.yusmallkatakana = 0x30e5; t.yusmallkatakanahalfwidth = 0xff6d; t.yuyekorean = 0x318b; t.yuyeokorean = 0x318a; t.yyabengali = 0x09df; t.yyadeva = 0x095f; t.z = 0x007a; t.zaarmenian = 0x0566; t.zacute = 0x017a; t.zadeva = 0x095b; t.zagurmukhi = 0x0a5b; t.zaharabic = 0x0638; t.zahfinalarabic = 0xfec6; t.zahinitialarabic = 0xfec7; t.zahiragana = 0x3056; t.zahmedialarabic = 0xfec8; t.zainarabic = 0x0632; t.zainfinalarabic = 0xfeb0; t.zakatakana = 0x30b6; t.zaqefgadolhebrew = 0x0595; t.zaqefqatanhebrew = 0x0594; t.zarqahebrew = 0x0598; t.zayin = 0x05d6; t.zayindagesh = 0xfb36; t.zayindageshhebrew = 0xfb36; t.zayinhebrew = 0x05d6; t.zbopomofo = 0x3117; t.zcaron = 0x017e; t.zcircle = 0x24e9; t.zcircumflex = 0x1e91; t.zcurl = 0x0291; t.zdot = 0x017c; t.zdotaccent = 0x017c; t.zdotbelow = 0x1e93; t.zecyrillic = 0x0437; t.zedescendercyrillic = 0x0499; t.zedieresiscyrillic = 0x04df; t.zehiragana = 0x305c; t.zekatakana = 0x30bc; t.zero = 0x0030; t.zeroarabic = 0x0660; t.zerobengali = 0x09e6; t.zerodeva = 0x0966; t.zerogujarati = 0x0ae6; t.zerogurmukhi = 0x0a66; t.zerohackarabic = 0x0660; t.zeroinferior = 0x2080; t.zeromonospace = 0xff10; t.zerooldstyle = 0xf730; t.zeropersian = 0x06f0; t.zerosuperior = 0x2070; t.zerothai = 0x0e50; t.zerowidthjoiner = 0xfeff; t.zerowidthnonjoiner = 0x200c; t.zerowidthspace = 0x200b; t.zeta = 0x03b6; t.zhbopomofo = 0x3113; t.zhearmenian = 0x056a; t.zhebrevecyrillic = 0x04c2; t.zhecyrillic = 0x0436; t.zhedescendercyrillic = 0x0497; t.zhedieresiscyrillic = 0x04dd; t.zihiragana = 0x3058; t.zikatakana = 0x30b8; t.zinorhebrew = 0x05ae; t.zlinebelow = 0x1e95; t.zmonospace = 0xff5a; t.zohiragana = 0x305e; t.zokatakana = 0x30be; t.zparen = 0x24b5; t.zretroflexhook = 0x0290; t.zstroke = 0x01b6; t.zuhiragana = 0x305a; t.zukatakana = 0x30ba; t[".notdef"] = 0x0000; t.angbracketleftbig = 0x2329; t.angbracketleftBig = 0x2329; t.angbracketleftbigg = 0x2329; t.angbracketleftBigg = 0x2329; t.angbracketrightBig = 0x232a; t.angbracketrightbig = 0x232a; t.angbracketrightBigg = 0x232a; t.angbracketrightbigg = 0x232a; t.arrowhookleft = 0x21aa; t.arrowhookright = 0x21a9; t.arrowlefttophalf = 0x21bc; t.arrowleftbothalf = 0x21bd; t.arrownortheast = 0x2197; t.arrownorthwest = 0x2196; t.arrowrighttophalf = 0x21c0; t.arrowrightbothalf = 0x21c1; t.arrowsoutheast = 0x2198; t.arrowsouthwest = 0x2199; t.backslashbig = 0x2216; t.backslashBig = 0x2216; t.backslashBigg = 0x2216; t.backslashbigg = 0x2216; t.bardbl = 0x2016; t.bracehtipdownleft = 0xfe37; t.bracehtipdownright = 0xfe37; t.bracehtipupleft = 0xfe38; t.bracehtipupright = 0xfe38; t.braceleftBig = 0x007b; t.braceleftbig = 0x007b; t.braceleftbigg = 0x007b; t.braceleftBigg = 0x007b; t.bracerightBig = 0x007d; t.bracerightbig = 0x007d; t.bracerightbigg = 0x007d; t.bracerightBigg = 0x007d; t.bracketleftbig = 0x005b; t.bracketleftBig = 0x005b; t.bracketleftbigg = 0x005b; t.bracketleftBigg = 0x005b; t.bracketrightBig = 0x005d; t.bracketrightbig = 0x005d; t.bracketrightbigg = 0x005d; t.bracketrightBigg = 0x005d; t.ceilingleftbig = 0x2308; t.ceilingleftBig = 0x2308; t.ceilingleftBigg = 0x2308; t.ceilingleftbigg = 0x2308; t.ceilingrightbig = 0x2309; t.ceilingrightBig = 0x2309; t.ceilingrightbigg = 0x2309; t.ceilingrightBigg = 0x2309; t.circledotdisplay = 0x2299; t.circledottext = 0x2299; t.circlemultiplydisplay = 0x2297; t.circlemultiplytext = 0x2297; t.circleplusdisplay = 0x2295; t.circleplustext = 0x2295; t.contintegraldisplay = 0x222e; t.contintegraltext = 0x222e; t.coproductdisplay = 0x2210; t.coproducttext = 0x2210; t.floorleftBig = 0x230a; t.floorleftbig = 0x230a; t.floorleftbigg = 0x230a; t.floorleftBigg = 0x230a; t.floorrightbig = 0x230b; t.floorrightBig = 0x230b; t.floorrightBigg = 0x230b; t.floorrightbigg = 0x230b; t.hatwide = 0x0302; t.hatwider = 0x0302; t.hatwidest = 0x0302; t.intercal = 0x1d40; t.integraldisplay = 0x222b; t.integraltext = 0x222b; t.intersectiondisplay = 0x22c2; t.intersectiontext = 0x22c2; t.logicalanddisplay = 0x2227; t.logicalandtext = 0x2227; t.logicalordisplay = 0x2228; t.logicalortext = 0x2228; t.parenleftBig = 0x0028; t.parenleftbig = 0x0028; t.parenleftBigg = 0x0028; t.parenleftbigg = 0x0028; t.parenrightBig = 0x0029; t.parenrightbig = 0x0029; t.parenrightBigg = 0x0029; t.parenrightbigg = 0x0029; t.prime = 0x2032; t.productdisplay = 0x220f; t.producttext = 0x220f; t.radicalbig = 0x221a; t.radicalBig = 0x221a; t.radicalBigg = 0x221a; t.radicalbigg = 0x221a; t.radicalbt = 0x221a; t.radicaltp = 0x221a; t.radicalvertex = 0x221a; t.slashbig = 0x002f; t.slashBig = 0x002f; t.slashBigg = 0x002f; t.slashbigg = 0x002f; t.summationdisplay = 0x2211; t.summationtext = 0x2211; t.tildewide = 0x02dc; t.tildewider = 0x02dc; t.tildewidest = 0x02dc; t.uniondisplay = 0x22c3; t.unionmultidisplay = 0x228e; t.unionmultitext = 0x228e; t.unionsqdisplay = 0x2294; t.unionsqtext = 0x2294; t.uniontext = 0x22c3; t.vextenddouble = 0x2225; t.vextendsingle = 0x2223; }); const getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) { t.space = 0x0020; t.a1 = 0x2701; t.a2 = 0x2702; t.a202 = 0x2703; t.a3 = 0x2704; t.a4 = 0x260e; t.a5 = 0x2706; t.a119 = 0x2707; t.a118 = 0x2708; t.a117 = 0x2709; t.a11 = 0x261b; t.a12 = 0x261e; t.a13 = 0x270c; t.a14 = 0x270d; t.a15 = 0x270e; t.a16 = 0x270f; t.a105 = 0x2710; t.a17 = 0x2711; t.a18 = 0x2712; t.a19 = 0x2713; t.a20 = 0x2714; t.a21 = 0x2715; t.a22 = 0x2716; t.a23 = 0x2717; t.a24 = 0x2718; t.a25 = 0x2719; t.a26 = 0x271a; t.a27 = 0x271b; t.a28 = 0x271c; t.a6 = 0x271d; t.a7 = 0x271e; t.a8 = 0x271f; t.a9 = 0x2720; t.a10 = 0x2721; t.a29 = 0x2722; t.a30 = 0x2723; t.a31 = 0x2724; t.a32 = 0x2725; t.a33 = 0x2726; t.a34 = 0x2727; t.a35 = 0x2605; t.a36 = 0x2729; t.a37 = 0x272a; t.a38 = 0x272b; t.a39 = 0x272c; t.a40 = 0x272d; t.a41 = 0x272e; t.a42 = 0x272f; t.a43 = 0x2730; t.a44 = 0x2731; t.a45 = 0x2732; t.a46 = 0x2733; t.a47 = 0x2734; t.a48 = 0x2735; t.a49 = 0x2736; t.a50 = 0x2737; t.a51 = 0x2738; t.a52 = 0x2739; t.a53 = 0x273a; t.a54 = 0x273b; t.a55 = 0x273c; t.a56 = 0x273d; t.a57 = 0x273e; t.a58 = 0x273f; t.a59 = 0x2740; t.a60 = 0x2741; t.a61 = 0x2742; t.a62 = 0x2743; t.a63 = 0x2744; t.a64 = 0x2745; t.a65 = 0x2746; t.a66 = 0x2747; t.a67 = 0x2748; t.a68 = 0x2749; t.a69 = 0x274a; t.a70 = 0x274b; t.a71 = 0x25cf; t.a72 = 0x274d; t.a73 = 0x25a0; t.a74 = 0x274f; t.a203 = 0x2750; t.a75 = 0x2751; t.a204 = 0x2752; t.a76 = 0x25b2; t.a77 = 0x25bc; t.a78 = 0x25c6; t.a79 = 0x2756; t.a81 = 0x25d7; t.a82 = 0x2758; t.a83 = 0x2759; t.a84 = 0x275a; t.a97 = 0x275b; t.a98 = 0x275c; t.a99 = 0x275d; t.a100 = 0x275e; t.a101 = 0x2761; t.a102 = 0x2762; t.a103 = 0x2763; t.a104 = 0x2764; t.a106 = 0x2765; t.a107 = 0x2766; t.a108 = 0x2767; t.a112 = 0x2663; t.a111 = 0x2666; t.a110 = 0x2665; t.a109 = 0x2660; t.a120 = 0x2460; t.a121 = 0x2461; t.a122 = 0x2462; t.a123 = 0x2463; t.a124 = 0x2464; t.a125 = 0x2465; t.a126 = 0x2466; t.a127 = 0x2467; t.a128 = 0x2468; t.a129 = 0x2469; t.a130 = 0x2776; t.a131 = 0x2777; t.a132 = 0x2778; t.a133 = 0x2779; t.a134 = 0x277a; t.a135 = 0x277b; t.a136 = 0x277c; t.a137 = 0x277d; t.a138 = 0x277e; t.a139 = 0x277f; t.a140 = 0x2780; t.a141 = 0x2781; t.a142 = 0x2782; t.a143 = 0x2783; t.a144 = 0x2784; t.a145 = 0x2785; t.a146 = 0x2786; t.a147 = 0x2787; t.a148 = 0x2788; t.a149 = 0x2789; t.a150 = 0x278a; t.a151 = 0x278b; t.a152 = 0x278c; t.a153 = 0x278d; t.a154 = 0x278e; t.a155 = 0x278f; t.a156 = 0x2790; t.a157 = 0x2791; t.a158 = 0x2792; t.a159 = 0x2793; t.a160 = 0x2794; t.a161 = 0x2192; t.a163 = 0x2194; t.a164 = 0x2195; t.a196 = 0x2798; t.a165 = 0x2799; t.a192 = 0x279a; t.a166 = 0x279b; t.a167 = 0x279c; t.a168 = 0x279d; t.a169 = 0x279e; t.a170 = 0x279f; t.a171 = 0x27a0; t.a172 = 0x27a1; t.a173 = 0x27a2; t.a162 = 0x27a3; t.a174 = 0x27a4; t.a175 = 0x27a5; t.a176 = 0x27a6; t.a177 = 0x27a7; t.a178 = 0x27a8; t.a179 = 0x27a9; t.a193 = 0x27aa; t.a180 = 0x27ab; t.a199 = 0x27ac; t.a181 = 0x27ad; t.a200 = 0x27ae; t.a182 = 0x27af; t.a201 = 0x27b1; t.a183 = 0x27b2; t.a184 = 0x27b3; t.a197 = 0x27b4; t.a185 = 0x27b5; t.a194 = 0x27b6; t.a198 = 0x27b7; t.a186 = 0x27b8; t.a195 = 0x27b9; t.a187 = 0x27ba; t.a188 = 0x27bb; t.a189 = 0x27bc; t.a190 = 0x27bd; t.a191 = 0x27be; t.a89 = 0x2768; t.a90 = 0x2769; t.a93 = 0x276a; t.a94 = 0x276b; t.a91 = 0x276c; t.a92 = 0x276d; t.a205 = 0x276e; t.a85 = 0x276f; t.a206 = 0x2770; t.a86 = 0x2771; t.a87 = 0x2772; t.a88 = 0x2773; t.a95 = 0x2774; t.a96 = 0x2775; t[".notdef"] = 0x0000; }); ;// CONCATENATED MODULE: ./src/core/unicode.js const getSpecialPUASymbols = getLookupTableFactory(function (t) { t[63721] = 0x00a9; t[63193] = 0x00a9; t[63720] = 0x00ae; t[63194] = 0x00ae; t[63722] = 0x2122; t[63195] = 0x2122; t[63729] = 0x23a7; t[63730] = 0x23a8; t[63731] = 0x23a9; t[63740] = 0x23ab; t[63741] = 0x23ac; t[63742] = 0x23ad; t[63726] = 0x23a1; t[63727] = 0x23a2; t[63728] = 0x23a3; t[63737] = 0x23a4; t[63738] = 0x23a5; t[63739] = 0x23a6; t[63723] = 0x239b; t[63724] = 0x239c; t[63725] = 0x239d; t[63734] = 0x239e; t[63735] = 0x239f; t[63736] = 0x23a0; }); function mapSpecialUnicodeValues(code) { if (code >= 0xfff0 && code <= 0xffff) { return 0; } else if (code >= 0xf600 && code <= 0xf8ff) { return getSpecialPUASymbols()[code] || code; } else if (code === 0x00ad) { return 0x002d; } return code; } function getUnicodeForGlyph(name, glyphsUnicodeMap) { let unicode = glyphsUnicodeMap[name]; if (unicode !== undefined) { return unicode; } if (!name) { return -1; } if (name[0] === "u") { const nameLen = name.length; let hexStr; if (nameLen === 7 && name[1] === "n" && name[2] === "i") { hexStr = name.substring(3); } else if (nameLen >= 5 && nameLen <= 7) { hexStr = name.substring(1); } else { return -1; } if (hexStr === hexStr.toUpperCase()) { unicode = parseInt(hexStr, 16); if (unicode >= 0) { return unicode; } } } return -1; } const UnicodeRanges = [[0x0000, 0x007f], [0x0080, 0x00ff], [0x0100, 0x017f], [0x0180, 0x024f], [0x0250, 0x02af, 0x1d00, 0x1d7f, 0x1d80, 0x1dbf], [0x02b0, 0x02ff, 0xa700, 0xa71f], [0x0300, 0x036f, 0x1dc0, 0x1dff], [0x0370, 0x03ff], [0x2c80, 0x2cff], [0x0400, 0x04ff, 0x0500, 0x052f, 0x2de0, 0x2dff, 0xa640, 0xa69f], [0x0530, 0x058f], [0x0590, 0x05ff], [0xa500, 0xa63f], [0x0600, 0x06ff, 0x0750, 0x077f], [0x07c0, 0x07ff], [0x0900, 0x097f], [0x0980, 0x09ff], [0x0a00, 0x0a7f], [0x0a80, 0x0aff], [0x0b00, 0x0b7f], [0x0b80, 0x0bff], [0x0c00, 0x0c7f], [0x0c80, 0x0cff], [0x0d00, 0x0d7f], [0x0e00, 0x0e7f], [0x0e80, 0x0eff], [0x10a0, 0x10ff, 0x2d00, 0x2d2f], [0x1b00, 0x1b7f], [0x1100, 0x11ff], [0x1e00, 0x1eff, 0x2c60, 0x2c7f, 0xa720, 0xa7ff], [0x1f00, 0x1fff], [0x2000, 0x206f, 0x2e00, 0x2e7f], [0x2070, 0x209f], [0x20a0, 0x20cf], [0x20d0, 0x20ff], [0x2100, 0x214f], [0x2150, 0x218f], [0x2190, 0x21ff, 0x27f0, 0x27ff, 0x2900, 0x297f, 0x2b00, 0x2bff], [0x2200, 0x22ff, 0x2a00, 0x2aff, 0x27c0, 0x27ef, 0x2980, 0x29ff], [0x2300, 0x23ff], [0x2400, 0x243f], [0x2440, 0x245f], [0x2460, 0x24ff], [0x2500, 0x257f], [0x2580, 0x259f], [0x25a0, 0x25ff], [0x2600, 0x26ff], [0x2700, 0x27bf], [0x3000, 0x303f], [0x3040, 0x309f], [0x30a0, 0x30ff, 0x31f0, 0x31ff], [0x3100, 0x312f, 0x31a0, 0x31bf], [0x3130, 0x318f], [0xa840, 0xa87f], [0x3200, 0x32ff], [0x3300, 0x33ff], [0xac00, 0xd7af], [0xd800, 0xdfff], [0x10900, 0x1091f], [0x4e00, 0x9fff, 0x2e80, 0x2eff, 0x2f00, 0x2fdf, 0x2ff0, 0x2fff, 0x3400, 0x4dbf, 0x20000, 0x2a6df, 0x3190, 0x319f], [0xe000, 0xf8ff], [0x31c0, 0x31ef, 0xf900, 0xfaff, 0x2f800, 0x2fa1f], [0xfb00, 0xfb4f], [0xfb50, 0xfdff], [0xfe20, 0xfe2f], [0xfe10, 0xfe1f], [0xfe50, 0xfe6f], [0xfe70, 0xfeff], [0xff00, 0xffef], [0xfff0, 0xffff], [0x0f00, 0x0fff], [0x0700, 0x074f], [0x0780, 0x07bf], [0x0d80, 0x0dff], [0x1000, 0x109f], [0x1200, 0x137f, 0x1380, 0x139f, 0x2d80, 0x2ddf], [0x13a0, 0x13ff], [0x1400, 0x167f], [0x1680, 0x169f], [0x16a0, 0x16ff], [0x1780, 0x17ff], [0x1800, 0x18af], [0x2800, 0x28ff], [0xa000, 0xa48f], [0x1700, 0x171f, 0x1720, 0x173f, 0x1740, 0x175f, 0x1760, 0x177f], [0x10300, 0x1032f], [0x10330, 0x1034f], [0x10400, 0x1044f], [0x1d000, 0x1d0ff, 0x1d100, 0x1d1ff, 0x1d200, 0x1d24f], [0x1d400, 0x1d7ff], [0xff000, 0xffffd], [0xfe00, 0xfe0f, 0xe0100, 0xe01ef], [0xe0000, 0xe007f], [0x1900, 0x194f], [0x1950, 0x197f], [0x1980, 0x19df], [0x1a00, 0x1a1f], [0x2c00, 0x2c5f], [0x2d30, 0x2d7f], [0x4dc0, 0x4dff], [0xa800, 0xa82f], [0x10000, 0x1007f, 0x10080, 0x100ff, 0x10100, 0x1013f], [0x10140, 0x1018f], [0x10380, 0x1039f], [0x103a0, 0x103df], [0x10450, 0x1047f], [0x10480, 0x104af], [0x10800, 0x1083f], [0x10a00, 0x10a5f], [0x1d300, 0x1d35f], [0x12000, 0x123ff, 0x12400, 0x1247f], [0x1d360, 0x1d37f], [0x1b80, 0x1bbf], [0x1c00, 0x1c4f], [0x1c50, 0x1c7f], [0xa880, 0xa8df], [0xa900, 0xa92f], [0xa930, 0xa95f], [0xaa00, 0xaa5f], [0x10190, 0x101cf], [0x101d0, 0x101ff], [0x102a0, 0x102df, 0x10280, 0x1029f, 0x10920, 0x1093f], [0x1f030, 0x1f09f, 0x1f000, 0x1f02f]]; function getUnicodeRangeFor(value, lastPosition = -1) { if (lastPosition !== -1) { const range = UnicodeRanges[lastPosition]; for (let i = 0, ii = range.length; i < ii; i += 2) { if (value >= range[i] && value <= range[i + 1]) { return lastPosition; } } } for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) { const range = UnicodeRanges[i]; for (let j = 0, jj = range.length; j < jj; j += 2) { if (value >= range[j] && value <= range[j + 1]) { return i; } } } return -1; } const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u"); const CategoryCache = new Map(); function getCharUnicodeCategory(char) { const cachedCategory = CategoryCache.get(char); if (cachedCategory) { return cachedCategory; } const groups = char.match(SpecialCharRegExp); const category = { isWhitespace: !!groups?.[1], isZeroWidthDiacritic: !!groups?.[2], isInvisibleFormatMark: !!groups?.[3] }; CategoryCache.set(char, category); return category; } function clearUnicodeCaches() { CategoryCache.clear(); } ;// CONCATENATED MODULE: ./src/core/fonts_utils.js const SEAC_ANALYSIS_ENABLED = true; const FontFlags = { FixedPitch: 1, Serif: 2, Symbolic: 4, Script: 8, Nonsymbolic: 32, Italic: 64, AllCap: 65536, SmallCap: 131072, ForceBold: 262144 }; const MacStandardGlyphOrdering = [".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "Lslash", "lslash", "Scaron", "scaron", "Zcaron", "zcaron", "brokenbar", "Eth", "eth", "Yacute", "yacute", "Thorn", "thorn", "minus", "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter", "threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute", "Ccaron", "ccaron", "dcroat"]; function recoverGlyphName(name, glyphsUnicodeMap) { if (glyphsUnicodeMap[name] !== undefined) { return name; } const unicode = getUnicodeForGlyph(name, glyphsUnicodeMap); if (unicode !== -1) { for (const key in glyphsUnicodeMap) { if (glyphsUnicodeMap[key] === unicode) { return key; } } } info("Unable to recover a standard glyph name for: " + name); return name; } function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) { const charCodeToGlyphId = Object.create(null); let glyphId, charCode, baseEncoding; const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); if (properties.isInternalFont) { baseEncoding = builtInEncoding; for (charCode = 0; charCode < baseEncoding.length; charCode++) { glyphId = glyphNames.indexOf(baseEncoding[charCode]); charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0; } } else if (properties.baseEncodingName) { baseEncoding = getEncoding(properties.baseEncodingName); for (charCode = 0; charCode < baseEncoding.length; charCode++) { glyphId = glyphNames.indexOf(baseEncoding[charCode]); charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0; } } else if (isSymbolicFont) { for (charCode in builtInEncoding) { charCodeToGlyphId[charCode] = builtInEncoding[charCode]; } } else { baseEncoding = StandardEncoding; for (charCode = 0; charCode < baseEncoding.length; charCode++) { glyphId = glyphNames.indexOf(baseEncoding[charCode]); charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0; } } const differences = properties.differences; let glyphsUnicodeMap; if (differences) { for (charCode in differences) { const glyphName = differences[charCode]; glyphId = glyphNames.indexOf(glyphName); if (glyphId === -1) { if (!glyphsUnicodeMap) { glyphsUnicodeMap = getGlyphsUnicode(); } const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap); if (standardGlyphName !== glyphName) { glyphId = glyphNames.indexOf(standardGlyphName); } } charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0; } } return charCodeToGlyphId; } function normalizeFontName(name) { return name.replaceAll(/[,_]/g, "-").replaceAll(/\s/g, ""); } ;// CONCATENATED MODULE: ./src/core/standard_fonts.js const getStdFontMap = getLookupTableFactory(function (t) { t["Times-Roman"] = "Times-Roman"; t.Helvetica = "Helvetica"; t.Courier = "Courier"; t.Symbol = "Symbol"; t["Times-Bold"] = "Times-Bold"; t["Helvetica-Bold"] = "Helvetica-Bold"; t["Courier-Bold"] = "Courier-Bold"; t.ZapfDingbats = "ZapfDingbats"; t["Times-Italic"] = "Times-Italic"; t["Helvetica-Oblique"] = "Helvetica-Oblique"; t["Courier-Oblique"] = "Courier-Oblique"; t["Times-BoldItalic"] = "Times-BoldItalic"; t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique"; t["Courier-BoldOblique"] = "Courier-BoldOblique"; t.ArialNarrow = "Helvetica"; t["ArialNarrow-Bold"] = "Helvetica-Bold"; t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique"; t["ArialNarrow-Italic"] = "Helvetica-Oblique"; t.ArialBlack = "Helvetica"; t["ArialBlack-Bold"] = "Helvetica-Bold"; t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique"; t["ArialBlack-Italic"] = "Helvetica-Oblique"; t["Arial-Black"] = "Helvetica"; t["Arial-Black-Bold"] = "Helvetica-Bold"; t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique"; t["Arial-Black-Italic"] = "Helvetica-Oblique"; t.Arial = "Helvetica"; t["Arial-Bold"] = "Helvetica-Bold"; t["Arial-BoldItalic"] = "Helvetica-BoldOblique"; t["Arial-Italic"] = "Helvetica-Oblique"; t.ArialMT = "Helvetica"; t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique"; t["Arial-BoldMT"] = "Helvetica-Bold"; t["Arial-ItalicMT"] = "Helvetica-Oblique"; t["Arial-BoldItalicMT-BoldItalic"] = "Helvetica-BoldOblique"; t["Arial-BoldMT-Bold"] = "Helvetica-Bold"; t["Arial-ItalicMT-Italic"] = "Helvetica-Oblique"; t.ArialUnicodeMS = "Helvetica"; t["ArialUnicodeMS-Bold"] = "Helvetica-Bold"; t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique"; t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique"; t["Courier-BoldItalic"] = "Courier-BoldOblique"; t["Courier-Italic"] = "Courier-Oblique"; t.CourierNew = "Courier"; t["CourierNew-Bold"] = "Courier-Bold"; t["CourierNew-BoldItalic"] = "Courier-BoldOblique"; t["CourierNew-Italic"] = "Courier-Oblique"; t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique"; t["CourierNewPS-BoldMT"] = "Courier-Bold"; t["CourierNewPS-ItalicMT"] = "Courier-Oblique"; t.CourierNewPSMT = "Courier"; t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique"; t["Helvetica-Italic"] = "Helvetica-Oblique"; t["Symbol-Bold"] = "Symbol"; t["Symbol-BoldItalic"] = "Symbol"; t["Symbol-Italic"] = "Symbol"; t.TimesNewRoman = "Times-Roman"; t["TimesNewRoman-Bold"] = "Times-Bold"; t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic"; t["TimesNewRoman-Italic"] = "Times-Italic"; t.TimesNewRomanPS = "Times-Roman"; t["TimesNewRomanPS-Bold"] = "Times-Bold"; t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic"; t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic"; t["TimesNewRomanPS-BoldMT"] = "Times-Bold"; t["TimesNewRomanPS-Italic"] = "Times-Italic"; t["TimesNewRomanPS-ItalicMT"] = "Times-Italic"; t.TimesNewRomanPSMT = "Times-Roman"; t["TimesNewRomanPSMT-Bold"] = "Times-Bold"; t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic"; t["TimesNewRomanPSMT-Italic"] = "Times-Italic"; }); const getFontNameToFileMap = getLookupTableFactory(function (t) { t.Courier = "FoxitFixed.pfb"; t["Courier-Bold"] = "FoxitFixedBold.pfb"; t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb"; t["Courier-Oblique"] = "FoxitFixedItalic.pfb"; t.Helvetica = "LiberationSans-Regular.ttf"; t["Helvetica-Bold"] = "LiberationSans-Bold.ttf"; t["Helvetica-BoldOblique"] = "LiberationSans-BoldItalic.ttf"; t["Helvetica-Oblique"] = "LiberationSans-Italic.ttf"; t["Times-Roman"] = "FoxitSerif.pfb"; t["Times-Bold"] = "FoxitSerifBold.pfb"; t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb"; t["Times-Italic"] = "FoxitSerifItalic.pfb"; t.Symbol = "FoxitSymbol.pfb"; t.ZapfDingbats = "FoxitDingbats.pfb"; t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf"; t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf"; t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf"; t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf"; }); const getNonStdFontMap = getLookupTableFactory(function (t) { t.Calibri = "Helvetica"; t["Calibri-Bold"] = "Helvetica-Bold"; t["Calibri-BoldItalic"] = "Helvetica-BoldOblique"; t["Calibri-Italic"] = "Helvetica-Oblique"; t.CenturyGothic = "Helvetica"; t["CenturyGothic-Bold"] = "Helvetica-Bold"; t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique"; t["CenturyGothic-Italic"] = "Helvetica-Oblique"; t.ComicSansMS = "Comic Sans MS"; t["ComicSansMS-Bold"] = "Comic Sans MS-Bold"; t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic"; t["ComicSansMS-Italic"] = "Comic Sans MS-Italic"; t.Impact = "Helvetica"; t["ItcSymbol-Bold"] = "Helvetica-Bold"; t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique"; t["ItcSymbol-Book"] = "Helvetica"; t["ItcSymbol-BookItalic"] = "Helvetica-Oblique"; t["ItcSymbol-Medium"] = "Helvetica"; t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique"; t.LucidaConsole = "Courier"; t["LucidaConsole-Bold"] = "Courier-Bold"; t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique"; t["LucidaConsole-Italic"] = "Courier-Oblique"; t["LucidaSans-Demi"] = "Helvetica-Bold"; t["MS-Gothic"] = "MS Gothic"; t["MS-Gothic-Bold"] = "MS Gothic-Bold"; t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic"; t["MS-Gothic-Italic"] = "MS Gothic-Italic"; t["MS-Mincho"] = "MS Mincho"; t["MS-Mincho-Bold"] = "MS Mincho-Bold"; t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic"; t["MS-Mincho-Italic"] = "MS Mincho-Italic"; t["MS-PGothic"] = "MS PGothic"; t["MS-PGothic-Bold"] = "MS PGothic-Bold"; t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic"; t["MS-PGothic-Italic"] = "MS PGothic-Italic"; t["MS-PMincho"] = "MS PMincho"; t["MS-PMincho-Bold"] = "MS PMincho-Bold"; t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic"; t["MS-PMincho-Italic"] = "MS PMincho-Italic"; t.NuptialScript = "Times-Italic"; t.SegoeUISymbol = "Helvetica"; }); const getSerifFonts = getLookupTableFactory(function (t) { t["Adobe Jenson"] = true; t["Adobe Text"] = true; t.Albertus = true; t.Aldus = true; t.Alexandria = true; t.Algerian = true; t["American Typewriter"] = true; t.Antiqua = true; t.Apex = true; t.Arno = true; t.Aster = true; t.Aurora = true; t.Baskerville = true; t.Bell = true; t.Bembo = true; t["Bembo Schoolbook"] = true; t.Benguiat = true; t["Berkeley Old Style"] = true; t["Bernhard Modern"] = true; t["Berthold City"] = true; t.Bodoni = true; t["Bauer Bodoni"] = true; t["Book Antiqua"] = true; t.Bookman = true; t["Bordeaux Roman"] = true; t["Californian FB"] = true; t.Calisto = true; t.Calvert = true; t.Capitals = true; t.Cambria = true; t.Cartier = true; t.Caslon = true; t.Catull = true; t.Centaur = true; t["Century Old Style"] = true; t["Century Schoolbook"] = true; t.Chaparral = true; t["Charis SIL"] = true; t.Cheltenham = true; t["Cholla Slab"] = true; t.Clarendon = true; t.Clearface = true; t.Cochin = true; t.Colonna = true; t["Computer Modern"] = true; t["Concrete Roman"] = true; t.Constantia = true; t["Cooper Black"] = true; t.Corona = true; t.Ecotype = true; t.Egyptienne = true; t.Elephant = true; t.Excelsior = true; t.Fairfield = true; t["FF Scala"] = true; t.Folkard = true; t.Footlight = true; t.FreeSerif = true; t["Friz Quadrata"] = true; t.Garamond = true; t.Gentium = true; t.Georgia = true; t.Gloucester = true; t["Goudy Old Style"] = true; t["Goudy Schoolbook"] = true; t["Goudy Pro Font"] = true; t.Granjon = true; t["Guardian Egyptian"] = true; t.Heather = true; t.Hercules = true; t["High Tower Text"] = true; t.Hiroshige = true; t["Hoefler Text"] = true; t["Humana Serif"] = true; t.Imprint = true; t["Ionic No. 5"] = true; t.Janson = true; t.Joanna = true; t.Korinna = true; t.Lexicon = true; t.LiberationSerif = true; t["Liberation Serif"] = true; t["Linux Libertine"] = true; t.Literaturnaya = true; t.Lucida = true; t["Lucida Bright"] = true; t.Melior = true; t.Memphis = true; t.Miller = true; t.Minion = true; t.Modern = true; t["Mona Lisa"] = true; t["Mrs Eaves"] = true; t["MS Serif"] = true; t["Museo Slab"] = true; t["New York"] = true; t["Nimbus Roman"] = true; t["NPS Rawlinson Roadway"] = true; t.NuptialScript = true; t.Palatino = true; t.Perpetua = true; t.Plantin = true; t["Plantin Schoolbook"] = true; t.Playbill = true; t["Poor Richard"] = true; t["Rawlinson Roadway"] = true; t.Renault = true; t.Requiem = true; t.Rockwell = true; t.Roman = true; t["Rotis Serif"] = true; t.Sabon = true; t.Scala = true; t.Seagull = true; t.Sistina = true; t.Souvenir = true; t.STIX = true; t["Stone Informal"] = true; t["Stone Serif"] = true; t.Sylfaen = true; t.Times = true; t.Trajan = true; t["Trinité"] = true; t["Trump Mediaeval"] = true; t.Utopia = true; t["Vale Type"] = true; t["Bitstream Vera"] = true; t["Vera Serif"] = true; t.Versailles = true; t.Wanted = true; t.Weiss = true; t["Wide Latin"] = true; t.Windsor = true; t.XITS = true; }); const getSymbolsFonts = getLookupTableFactory(function (t) { t.Dingbats = true; t.Symbol = true; t.ZapfDingbats = true; t.Wingdings = true; t["Wingdings-Bold"] = true; t["Wingdings-Regular"] = true; }); const getGlyphMapForStandardFonts = getLookupTableFactory(function (t) { t[2] = 10; t[3] = 32; t[4] = 33; t[5] = 34; t[6] = 35; t[7] = 36; t[8] = 37; t[9] = 38; t[10] = 39; t[11] = 40; t[12] = 41; t[13] = 42; t[14] = 43; t[15] = 44; t[16] = 45; t[17] = 46; t[18] = 47; t[19] = 48; t[20] = 49; t[21] = 50; t[22] = 51; t[23] = 52; t[24] = 53; t[25] = 54; t[26] = 55; t[27] = 56; t[28] = 57; t[29] = 58; t[30] = 894; t[31] = 60; t[32] = 61; t[33] = 62; t[34] = 63; t[35] = 64; t[36] = 65; t[37] = 66; t[38] = 67; t[39] = 68; t[40] = 69; t[41] = 70; t[42] = 71; t[43] = 72; t[44] = 73; t[45] = 74; t[46] = 75; t[47] = 76; t[48] = 77; t[49] = 78; t[50] = 79; t[51] = 80; t[52] = 81; t[53] = 82; t[54] = 83; t[55] = 84; t[56] = 85; t[57] = 86; t[58] = 87; t[59] = 88; t[60] = 89; t[61] = 90; t[62] = 91; t[63] = 92; t[64] = 93; t[65] = 94; t[66] = 95; t[67] = 96; t[68] = 97; t[69] = 98; t[70] = 99; t[71] = 100; t[72] = 101; t[73] = 102; t[74] = 103; t[75] = 104; t[76] = 105; t[77] = 106; t[78] = 107; t[79] = 108; t[80] = 109; t[81] = 110; t[82] = 111; t[83] = 112; t[84] = 113; t[85] = 114; t[86] = 115; t[87] = 116; t[88] = 117; t[89] = 118; t[90] = 119; t[91] = 120; t[92] = 121; t[93] = 122; t[94] = 123; t[95] = 124; t[96] = 125; t[97] = 126; t[98] = 196; t[99] = 197; t[100] = 199; t[101] = 201; t[102] = 209; t[103] = 214; t[104] = 220; t[105] = 225; t[106] = 224; t[107] = 226; t[108] = 228; t[109] = 227; t[110] = 229; t[111] = 231; t[112] = 233; t[113] = 232; t[114] = 234; t[115] = 235; t[116] = 237; t[117] = 236; t[118] = 238; t[119] = 239; t[120] = 241; t[121] = 243; t[122] = 242; t[123] = 244; t[124] = 246; t[125] = 245; t[126] = 250; t[127] = 249; t[128] = 251; t[129] = 252; t[130] = 8224; t[131] = 176; t[132] = 162; t[133] = 163; t[134] = 167; t[135] = 8226; t[136] = 182; t[137] = 223; t[138] = 174; t[139] = 169; t[140] = 8482; t[141] = 180; t[142] = 168; t[143] = 8800; t[144] = 198; t[145] = 216; t[146] = 8734; t[147] = 177; t[148] = 8804; t[149] = 8805; t[150] = 165; t[151] = 181; t[152] = 8706; t[153] = 8721; t[154] = 8719; t[156] = 8747; t[157] = 170; t[158] = 186; t[159] = 8486; t[160] = 230; t[161] = 248; t[162] = 191; t[163] = 161; t[164] = 172; t[165] = 8730; t[166] = 402; t[167] = 8776; t[168] = 8710; t[169] = 171; t[170] = 187; t[171] = 8230; t[179] = 8220; t[180] = 8221; t[181] = 8216; t[182] = 8217; t[200] = 193; t[203] = 205; t[207] = 211; t[210] = 218; t[223] = 711; t[224] = 321; t[225] = 322; t[226] = 352; t[227] = 353; t[228] = 381; t[229] = 382; t[233] = 221; t[234] = 253; t[252] = 263; t[253] = 268; t[254] = 269; t[258] = 258; t[260] = 260; t[261] = 261; t[265] = 280; t[266] = 281; t[267] = 282; t[268] = 283; t[269] = 313; t[275] = 323; t[276] = 324; t[278] = 328; t[283] = 344; t[284] = 345; t[285] = 346; t[286] = 347; t[292] = 367; t[295] = 377; t[296] = 378; t[298] = 380; t[305] = 963; t[306] = 964; t[307] = 966; t[308] = 8215; t[309] = 8252; t[310] = 8319; t[311] = 8359; t[312] = 8592; t[313] = 8593; t[337] = 9552; t[493] = 1039; t[494] = 1040; t[672] = 1488; t[673] = 1489; t[674] = 1490; t[675] = 1491; t[676] = 1492; t[677] = 1493; t[678] = 1494; t[679] = 1495; t[680] = 1496; t[681] = 1497; t[682] = 1498; t[683] = 1499; t[684] = 1500; t[685] = 1501; t[686] = 1502; t[687] = 1503; t[688] = 1504; t[689] = 1505; t[690] = 1506; t[691] = 1507; t[692] = 1508; t[693] = 1509; t[694] = 1510; t[695] = 1511; t[696] = 1512; t[697] = 1513; t[698] = 1514; t[705] = 1524; t[706] = 8362; t[710] = 64288; t[711] = 64298; t[759] = 1617; t[761] = 1776; t[763] = 1778; t[775] = 1652; t[777] = 1764; t[778] = 1780; t[779] = 1781; t[780] = 1782; t[782] = 771; t[783] = 64726; t[786] = 8363; t[788] = 8532; t[790] = 768; t[791] = 769; t[792] = 768; t[795] = 803; t[797] = 64336; t[798] = 64337; t[799] = 64342; t[800] = 64343; t[801] = 64344; t[802] = 64345; t[803] = 64362; t[804] = 64363; t[805] = 64364; t[2424] = 7821; t[2425] = 7822; t[2426] = 7823; t[2427] = 7824; t[2428] = 7825; t[2429] = 7826; t[2430] = 7827; t[2433] = 7682; t[2678] = 8045; t[2679] = 8046; t[2830] = 1552; t[2838] = 686; t[2840] = 751; t[2842] = 753; t[2843] = 754; t[2844] = 755; t[2846] = 757; t[2856] = 767; t[2857] = 848; t[2858] = 849; t[2862] = 853; t[2863] = 854; t[2864] = 855; t[2865] = 861; t[2866] = 862; t[2906] = 7460; t[2908] = 7462; t[2909] = 7463; t[2910] = 7464; t[2912] = 7466; t[2913] = 7467; t[2914] = 7468; t[2916] = 7470; t[2917] = 7471; t[2918] = 7472; t[2920] = 7474; t[2921] = 7475; t[2922] = 7476; t[2924] = 7478; t[2925] = 7479; t[2926] = 7480; t[2928] = 7482; t[2929] = 7483; t[2930] = 7484; t[2932] = 7486; t[2933] = 7487; t[2934] = 7488; t[2936] = 7490; t[2937] = 7491; t[2938] = 7492; t[2940] = 7494; t[2941] = 7495; t[2942] = 7496; t[2944] = 7498; t[2946] = 7500; t[2948] = 7502; t[2950] = 7504; t[2951] = 7505; t[2952] = 7506; t[2954] = 7508; t[2955] = 7509; t[2956] = 7510; t[2958] = 7512; t[2959] = 7513; t[2960] = 7514; t[2962] = 7516; t[2963] = 7517; t[2964] = 7518; t[2966] = 7520; t[2967] = 7521; t[2968] = 7522; t[2970] = 7524; t[2971] = 7525; t[2972] = 7526; t[2974] = 7528; t[2975] = 7529; t[2976] = 7530; t[2978] = 1537; t[2979] = 1538; t[2980] = 1539; t[2982] = 1549; t[2983] = 1551; t[2984] = 1552; t[2986] = 1554; t[2987] = 1555; t[2988] = 1556; t[2990] = 1623; t[2991] = 1624; t[2995] = 1775; t[2999] = 1791; t[3002] = 64290; t[3003] = 64291; t[3004] = 64292; t[3006] = 64294; t[3007] = 64295; t[3008] = 64296; t[3011] = 1900; t[3014] = 8223; t[3015] = 8244; t[3017] = 7532; t[3018] = 7533; t[3019] = 7534; t[3075] = 7590; t[3076] = 7591; t[3079] = 7594; t[3080] = 7595; t[3083] = 7598; t[3084] = 7599; t[3087] = 7602; t[3088] = 7603; t[3091] = 7606; t[3092] = 7607; t[3095] = 7610; t[3096] = 7611; t[3099] = 7614; t[3100] = 7615; t[3103] = 7618; t[3104] = 7619; t[3107] = 8337; t[3108] = 8338; t[3116] = 1884; t[3119] = 1885; t[3120] = 1885; t[3123] = 1886; t[3124] = 1886; t[3127] = 1887; t[3128] = 1887; t[3131] = 1888; t[3132] = 1888; t[3135] = 1889; t[3136] = 1889; t[3139] = 1890; t[3140] = 1890; t[3143] = 1891; t[3144] = 1891; t[3147] = 1892; t[3148] = 1892; t[3153] = 580; t[3154] = 581; t[3157] = 584; t[3158] = 585; t[3161] = 588; t[3162] = 589; t[3165] = 891; t[3166] = 892; t[3169] = 1274; t[3170] = 1275; t[3173] = 1278; t[3174] = 1279; t[3181] = 7622; t[3182] = 7623; t[3282] = 11799; t[3316] = 578; t[3379] = 42785; t[3393] = 1159; t[3416] = 8377; }); const getSupplementalGlyphMapForArialBlack = getLookupTableFactory(function (t) { t[227] = 322; t[264] = 261; t[291] = 346; }); const getSupplementalGlyphMapForCalibri = getLookupTableFactory(function (t) { t[1] = 32; t[4] = 65; t[5] = 192; t[6] = 193; t[9] = 196; t[17] = 66; t[18] = 67; t[21] = 268; t[24] = 68; t[28] = 69; t[29] = 200; t[30] = 201; t[32] = 282; t[38] = 70; t[39] = 71; t[44] = 72; t[47] = 73; t[48] = 204; t[49] = 205; t[58] = 74; t[60] = 75; t[62] = 76; t[68] = 77; t[69] = 78; t[75] = 79; t[76] = 210; t[80] = 214; t[87] = 80; t[89] = 81; t[90] = 82; t[92] = 344; t[94] = 83; t[97] = 352; t[100] = 84; t[104] = 85; t[109] = 220; t[115] = 86; t[116] = 87; t[121] = 88; t[122] = 89; t[124] = 221; t[127] = 90; t[129] = 381; t[258] = 97; t[259] = 224; t[260] = 225; t[263] = 228; t[268] = 261; t[271] = 98; t[272] = 99; t[273] = 263; t[275] = 269; t[282] = 100; t[286] = 101; t[287] = 232; t[288] = 233; t[290] = 283; t[295] = 281; t[296] = 102; t[336] = 103; t[346] = 104; t[349] = 105; t[350] = 236; t[351] = 237; t[361] = 106; t[364] = 107; t[367] = 108; t[371] = 322; t[373] = 109; t[374] = 110; t[381] = 111; t[382] = 242; t[383] = 243; t[386] = 246; t[393] = 112; t[395] = 113; t[396] = 114; t[398] = 345; t[400] = 115; t[401] = 347; t[403] = 353; t[410] = 116; t[437] = 117; t[442] = 252; t[448] = 118; t[449] = 119; t[454] = 120; t[455] = 121; t[457] = 253; t[460] = 122; t[462] = 382; t[463] = 380; t[853] = 44; t[855] = 58; t[856] = 46; t[876] = 47; t[878] = 45; t[882] = 45; t[894] = 40; t[895] = 41; t[896] = 91; t[897] = 93; t[923] = 64; t[1004] = 48; t[1005] = 49; t[1006] = 50; t[1007] = 51; t[1008] = 52; t[1009] = 53; t[1010] = 54; t[1011] = 55; t[1012] = 56; t[1013] = 57; t[1081] = 37; t[1085] = 43; t[1086] = 45; }); function getStandardFontName(name) { const fontName = normalizeFontName(name); const stdFontMap = getStdFontMap(); return stdFontMap[fontName]; } function isKnownFontName(name) { const fontName = normalizeFontName(name); return !!(getStdFontMap()[fontName] || getNonStdFontMap()[fontName] || getSerifFonts()[fontName] || getSymbolsFonts()[fontName]); } ;// CONCATENATED MODULE: ./src/core/to_unicode_map.js class ToUnicodeMap { constructor(cmap = []) { this._map = cmap; } get length() { return this._map.length; } forEach(callback) { for (const charCode in this._map) { callback(charCode, this._map[charCode].charCodeAt(0)); } } has(i) { return this._map[i] !== undefined; } get(i) { return this._map[i]; } charCodeOf(value) { const map = this._map; if (map.length <= 0x10000) { return map.indexOf(value); } for (const charCode in map) { if (map[charCode] === value) { return charCode | 0; } } return -1; } amend(map) { for (const charCode in map) { this._map[charCode] = map[charCode]; } } } class IdentityToUnicodeMap { constructor(firstChar, lastChar) { this.firstChar = firstChar; this.lastChar = lastChar; } get length() { return this.lastChar + 1 - this.firstChar; } forEach(callback) { for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) { callback(i, i); } } has(i) { return this.firstChar <= i && i <= this.lastChar; } get(i) { if (this.firstChar <= i && i <= this.lastChar) { return String.fromCharCode(i); } return undefined; } charCodeOf(v) { return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1; } amend(map) { unreachable("Should not call amend()"); } } ;// CONCATENATED MODULE: ./src/core/cff_font.js class CFFFont { constructor(file, properties) { this.properties = properties; const parser = new CFFParser(file, properties, SEAC_ANALYSIS_ENABLED); this.cff = parser.parse(); this.cff.duplicateFirstGlyph(); const compiler = new CFFCompiler(this.cff); this.seacs = this.cff.seacs; try { this.data = compiler.compile(); } catch { warn("Failed to compile font " + properties.loadedName); this.data = file; } this._createBuiltInEncoding(); } get numGlyphs() { return this.cff.charStrings.count; } getCharset() { return this.cff.charset.charset; } getGlyphMapping() { const cff = this.cff; const properties = this.properties; const { cidToGidMap, cMap } = properties; const charsets = cff.charset.charset; let charCodeToGlyphId; let glyphId; if (properties.composite) { let invCidToGidMap; if (cidToGidMap?.length > 0) { invCidToGidMap = Object.create(null); for (let i = 0, ii = cidToGidMap.length; i < ii; i++) { const gid = cidToGidMap[i]; if (gid !== undefined) { invCidToGidMap[gid] = i; } } } charCodeToGlyphId = Object.create(null); let charCode; if (cff.isCIDFont) { for (glyphId = 0; glyphId < charsets.length; glyphId++) { const cid = charsets[glyphId]; charCode = cMap.charCodeOf(cid); if (invCidToGidMap?.[charCode] !== undefined) { charCode = invCidToGidMap[charCode]; } charCodeToGlyphId[charCode] = glyphId; } } else { for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) { charCode = cMap.charCodeOf(glyphId); charCodeToGlyphId[charCode] = glyphId; } } return charCodeToGlyphId; } let encoding = cff.encoding ? cff.encoding.encoding : null; if (properties.isInternalFont) { encoding = properties.defaultEncoding; } charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets); return charCodeToGlyphId; } hasGlyphId(id) { return this.cff.hasGlyphId(id); } _createBuiltInEncoding() { const { charset, encoding } = this.cff; if (!charset || !encoding) { return; } const charsets = charset.charset, encodings = encoding.encoding; const map = []; for (const charCode in encodings) { const glyphId = encodings[charCode]; if (glyphId >= 0) { const glyphName = charsets[glyphId]; if (glyphName) { map[charCode] = glyphName; } } } if (map.length > 0) { this.properties.builtInEncoding = map; } } } ;// CONCATENATED MODULE: ./src/core/font_renderer.js function getUint32(data, offset) { return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0; } function getUint16(data, offset) { return data[offset] << 8 | data[offset + 1]; } function getInt16(data, offset) { return (data[offset] << 24 | data[offset + 1] << 16) >> 16; } function getInt8(data, offset) { return data[offset] << 24 >> 24; } function getFloat214(data, offset) { return getInt16(data, offset) / 16384; } function getSubroutineBias(subrs) { const numSubrs = subrs.length; let bias = 32768; if (numSubrs < 1240) { bias = 107; } else if (numSubrs < 33900) { bias = 1131; } return bias; } function parseCmap(data, start, end) { const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16); const format = getUint16(data, start + offset); let ranges, p, i; if (format === 4) { getUint16(data, start + offset + 2); const segCount = getUint16(data, start + offset + 6) >> 1; p = start + offset + 14; ranges = []; for (i = 0; i < segCount; i++, p += 2) { ranges[i] = { end: getUint16(data, p) }; } p += 2; for (i = 0; i < segCount; i++, p += 2) { ranges[i].start = getUint16(data, p); } for (i = 0; i < segCount; i++, p += 2) { ranges[i].idDelta = getUint16(data, p); } for (i = 0; i < segCount; i++, p += 2) { let idOffset = getUint16(data, p); if (idOffset === 0) { continue; } ranges[i].ids = []; for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) { ranges[i].ids[j] = getUint16(data, p + idOffset); idOffset += 2; } } return ranges; } else if (format === 12) { const groups = getUint32(data, start + offset + 12); p = start + offset + 16; ranges = []; for (i = 0; i < groups; i++) { start = getUint32(data, p); ranges.push({ start, end: getUint32(data, p + 4), idDelta: getUint32(data, p + 8) - start }); p += 12; } return ranges; } throw new FormatError(`unsupported cmap: ${format}`); } function parseCff(data, start, end, seacAnalysisEnabled) { const properties = {}; const parser = new CFFParser(new Stream(data, start, end - start), properties, seacAnalysisEnabled); const cff = parser.parse(); return { glyphs: cff.charStrings.objects, subrs: cff.topDict.privateDict?.subrsIndex?.objects, gsubrs: cff.globalSubrIndex?.objects, isCFFCIDFont: cff.isCIDFont, fdSelect: cff.fdSelect, fdArray: cff.fdArray }; } function parseGlyfTable(glyf, loca, isGlyphLocationsLong) { let itemSize, itemDecode; if (isGlyphLocationsLong) { itemSize = 4; itemDecode = getUint32; } else { itemSize = 2; itemDecode = (data, offset) => 2 * getUint16(data, offset); } const glyphs = []; let startOffset = itemDecode(loca, 0); for (let j = itemSize; j < loca.length; j += itemSize) { const endOffset = itemDecode(loca, j); glyphs.push(glyf.subarray(startOffset, endOffset)); startOffset = endOffset; } return glyphs; } function lookupCmap(ranges, unicode) { const code = unicode.codePointAt(0); let gid = 0, l = 0, r = ranges.length - 1; while (l < r) { const c = l + r + 1 >> 1; if (code < ranges[c].start) { r = c - 1; } else { l = c; } } if (ranges[l].start <= code && code <= ranges[l].end) { gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff; } return { charCode: code, glyphId: gid }; } function compileGlyf(code, cmds, font) { function moveTo(x, y) { cmds.add(FontRenderOps.MOVE_TO, [x, y]); } function lineTo(x, y) { cmds.add(FontRenderOps.LINE_TO, [x, y]); } function quadraticCurveTo(xa, ya, x, y) { cmds.add(FontRenderOps.QUADRATIC_CURVE_TO, [xa, ya, x, y]); } let i = 0; const numberOfContours = getInt16(code, i); let flags; let x = 0, y = 0; i += 10; if (numberOfContours < 0) { do { flags = getUint16(code, i); const glyphIndex = getUint16(code, i + 2); i += 4; let arg1, arg2; if (flags & 0x01) { if (flags & 0x02) { arg1 = getInt16(code, i); arg2 = getInt16(code, i + 2); } else { arg1 = getUint16(code, i); arg2 = getUint16(code, i + 2); } i += 4; } else if (flags & 0x02) { arg1 = getInt8(code, i++); arg2 = getInt8(code, i++); } else { arg1 = code[i++]; arg2 = code[i++]; } if (flags & 0x02) { x = arg1; y = arg2; } else { x = 0; y = 0; } let scaleX = 1, scaleY = 1, scale01 = 0, scale10 = 0; if (flags & 0x08) { scaleX = scaleY = getFloat214(code, i); i += 2; } else if (flags & 0x40) { scaleX = getFloat214(code, i); scaleY = getFloat214(code, i + 2); i += 4; } else if (flags & 0x80) { scaleX = getFloat214(code, i); scale01 = getFloat214(code, i + 2); scale10 = getFloat214(code, i + 4); scaleY = getFloat214(code, i + 6); i += 8; } const subglyph = font.glyphs[glyphIndex]; if (subglyph) { cmds.add(FontRenderOps.SAVE); cmds.add(FontRenderOps.TRANSFORM, [scaleX, scale01, scale10, scaleY, x, y]); if (!(flags & 0x02)) {} compileGlyf(subglyph, cmds, font); cmds.add(FontRenderOps.RESTORE); } } while (flags & 0x20); } else { const endPtsOfContours = []; let j, jj; for (j = 0; j < numberOfContours; j++) { endPtsOfContours.push(getUint16(code, i)); i += 2; } const instructionLength = getUint16(code, i); i += 2 + instructionLength; const numberOfPoints = endPtsOfContours.at(-1) + 1; const points = []; while (points.length < numberOfPoints) { flags = code[i++]; let repeat = 1; if (flags & 0x08) { repeat += code[i++]; } while (repeat-- > 0) { points.push({ flags }); } } for (j = 0; j < numberOfPoints; j++) { switch (points[j].flags & 0x12) { case 0x00: x += getInt16(code, i); i += 2; break; case 0x02: x -= code[i++]; break; case 0x12: x += code[i++]; break; } points[j].x = x; } for (j = 0; j < numberOfPoints; j++) { switch (points[j].flags & 0x24) { case 0x00: y += getInt16(code, i); i += 2; break; case 0x04: y -= code[i++]; break; case 0x24: y += code[i++]; break; } points[j].y = y; } let startPoint = 0; for (i = 0; i < numberOfContours; i++) { const endPoint = endPtsOfContours[i]; const contour = points.slice(startPoint, endPoint + 1); if (contour[0].flags & 1) { contour.push(contour[0]); } else if (contour.at(-1).flags & 1) { contour.unshift(contour.at(-1)); } else { const p = { flags: 1, x: (contour[0].x + contour.at(-1).x) / 2, y: (contour[0].y + contour.at(-1).y) / 2 }; contour.unshift(p); contour.push(p); } moveTo(contour[0].x, contour[0].y); for (j = 1, jj = contour.length; j < jj; j++) { if (contour[j].flags & 1) { lineTo(contour[j].x, contour[j].y); } else if (contour[j + 1].flags & 1) { quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y); j++; } else { quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2); } } startPoint = endPoint + 1; } } } function compileCharString(charStringCode, cmds, font, glyphId) { function moveTo(x, y) { cmds.add(FontRenderOps.MOVE_TO, [x, y]); } function lineTo(x, y) { cmds.add(FontRenderOps.LINE_TO, [x, y]); } function bezierCurveTo(x1, y1, x2, y2, x, y) { cmds.add(FontRenderOps.BEZIER_CURVE_TO, [x1, y1, x2, y2, x, y]); } const stack = []; let x = 0, y = 0; let stems = 0; function parse(code) { let i = 0; while (i < code.length) { let stackClean = false; let v = code[i++]; let xa, xb, ya, yb, y1, y2, y3, n, subrCode; switch (v) { case 1: stems += stack.length >> 1; stackClean = true; break; case 3: stems += stack.length >> 1; stackClean = true; break; case 4: y += stack.pop(); moveTo(x, y); stackClean = true; break; case 5: while (stack.length > 0) { x += stack.shift(); y += stack.shift(); lineTo(x, y); } break; case 6: while (stack.length > 0) { x += stack.shift(); lineTo(x, y); if (stack.length === 0) { break; } y += stack.shift(); lineTo(x, y); } break; case 7: while (stack.length > 0) { y += stack.shift(); lineTo(x, y); if (stack.length === 0) { break; } x += stack.shift(); lineTo(x, y); } break; case 8: while (stack.length > 0) { xa = x + stack.shift(); ya = y + stack.shift(); xb = xa + stack.shift(); yb = ya + stack.shift(); x = xb + stack.shift(); y = yb + stack.shift(); bezierCurveTo(xa, ya, xb, yb, x, y); } break; case 10: n = stack.pop(); subrCode = null; if (font.isCFFCIDFont) { const fdIndex = font.fdSelect.getFDIndex(glyphId); if (fdIndex >= 0 && fdIndex < font.fdArray.length) { const fontDict = font.fdArray[fdIndex]; let subrs; if (fontDict.privateDict?.subrsIndex) { subrs = fontDict.privateDict.subrsIndex.objects; } if (subrs) { n += getSubroutineBias(subrs); subrCode = subrs[n]; } } else { warn("Invalid fd index for glyph index."); } } else { subrCode = font.subrs[n + font.subrsBias]; } if (subrCode) { parse(subrCode); } break; case 11: return; case 12: v = code[i++]; switch (v) { case 34: xa = x + stack.shift(); xb = xa + stack.shift(); y1 = y + stack.shift(); x = xb + stack.shift(); bezierCurveTo(xa, y, xb, y1, x, y1); xa = x + stack.shift(); xb = xa + stack.shift(); x = xb + stack.shift(); bezierCurveTo(xa, y1, xb, y, x, y); break; case 35: xa = x + stack.shift(); ya = y + stack.shift(); xb = xa + stack.shift(); yb = ya + stack.shift(); x = xb + stack.shift(); y = yb + stack.shift(); bezierCurveTo(xa, ya, xb, yb, x, y); xa = x + stack.shift(); ya = y + stack.shift(); xb = xa + stack.shift(); yb = ya + stack.shift(); x = xb + stack.shift(); y = yb + stack.shift(); bezierCurveTo(xa, ya, xb, yb, x, y); stack.pop(); break; case 36: xa = x + stack.shift(); y1 = y + stack.shift(); xb = xa + stack.shift(); y2 = y1 + stack.shift(); x = xb + stack.shift(); bezierCurveTo(xa, y1, xb, y2, x, y2); xa = x + stack.shift(); xb = xa + stack.shift(); y3 = y2 + stack.shift(); x = xb + stack.shift(); bezierCurveTo(xa, y2, xb, y3, x, y); break; case 37: const x0 = x, y0 = y; xa = x + stack.shift(); ya = y + stack.shift(); xb = xa + stack.shift(); yb = ya + stack.shift(); x = xb + stack.shift(); y = yb + stack.shift(); bezierCurveTo(xa, ya, xb, yb, x, y); xa = x + stack.shift(); ya = y + stack.shift(); xb = xa + stack.shift(); yb = ya + stack.shift(); x = xb; y = yb; if (Math.abs(x - x0) > Math.abs(y - y0)) { x += stack.shift(); } else { y += stack.shift(); } bezierCurveTo(xa, ya, xb, yb, x, y); break; default: throw new FormatError(`unknown operator: 12 ${v}`); } break; case 14: if (stack.length >= 4) { const achar = stack.pop(); const bchar = stack.pop(); y = stack.pop(); x = stack.pop(); cmds.add(FontRenderOps.SAVE); cmds.add(FontRenderOps.TRANSLATE, [x, y]); let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[achar]])); compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId); cmds.add(FontRenderOps.RESTORE); cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[bchar]])); compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId); } return; case 18: stems += stack.length >> 1; stackClean = true; break; case 19: stems += stack.length >> 1; i += stems + 7 >> 3; stackClean = true; break; case 20: stems += stack.length >> 1; i += stems + 7 >> 3; stackClean = true; break; case 21: y += stack.pop(); x += stack.pop(); moveTo(x, y); stackClean = true; break; case 22: x += stack.pop(); moveTo(x, y); stackClean = true; break; case 23: stems += stack.length >> 1; stackClean = true; break; case 24: while (stack.length > 2) { xa = x + stack.shift(); ya = y + stack.shift(); xb = xa + stack.shift(); yb = ya + stack.shift(); x = xb + stack.shift(); y = yb + stack.shift(); bezierCurveTo(xa, ya, xb, yb, x, y); } x += stack.shift(); y += stack.shift(); lineTo(x, y); break; case 25: while (stack.length > 6) { x += stack.shift(); y += stack.shift(); lineTo(x, y); } xa = x + stack.shift(); ya = y + stack.shift(); xb = xa + stack.shift(); yb = ya + stack.shift(); x = xb + stack.shift(); y = yb + stack.shift(); bezierCurveTo(xa, ya, xb, yb, x, y); break; case 26: if (stack.length % 2) { x += stack.shift(); } while (stack.length > 0) { xa = x; ya = y + stack.shift(); xb = xa + stack.shift(); yb = ya + stack.shift(); x = xb; y = yb + stack.shift(); bezierCurveTo(xa, ya, xb, yb, x, y); } break; case 27: if (stack.length % 2) { y += stack.shift(); } while (stack.length > 0) { xa = x + stack.shift(); ya = y; xb = xa + stack.shift(); yb = ya + stack.shift(); x = xb + stack.shift(); y = yb; bezierCurveTo(xa, ya, xb, yb, x, y); } break; case 28: stack.push((code[i] << 24 | code[i + 1] << 16) >> 16); i += 2; break; case 29: n = stack.pop() + font.gsubrsBias; subrCode = font.gsubrs[n]; if (subrCode) { parse(subrCode); } break; case 30: while (stack.length > 0) { xa = x; ya = y + stack.shift(); xb = xa + stack.shift(); yb = ya + stack.shift(); x = xb + stack.shift(); y = yb + (stack.length === 1 ? stack.shift() : 0); bezierCurveTo(xa, ya, xb, yb, x, y); if (stack.length === 0) { break; } xa = x + stack.shift(); ya = y; xb = xa + stack.shift(); yb = ya + stack.shift(); y = yb + stack.shift(); x = xb + (stack.length === 1 ? stack.shift() : 0); bezierCurveTo(xa, ya, xb, yb, x, y); } break; case 31: while (stack.length > 0) { xa = x + stack.shift(); ya = y; xb = xa + stack.shift(); yb = ya + stack.shift(); y = yb + stack.shift(); x = xb + (stack.length === 1 ? stack.shift() : 0); bezierCurveTo(xa, ya, xb, yb, x, y); if (stack.length === 0) { break; } xa = x; ya = y + stack.shift(); xb = xa + stack.shift(); yb = ya + stack.shift(); x = xb + stack.shift(); y = yb + (stack.length === 1 ? stack.shift() : 0); bezierCurveTo(xa, ya, xb, yb, x, y); } break; default: if (v < 32) { throw new FormatError(`unknown operator: ${v}`); } if (v < 247) { stack.push(v - 139); } else if (v < 251) { stack.push((v - 247) * 256 + code[i++] + 108); } else if (v < 255) { stack.push(-(v - 251) * 256 - code[i++] - 108); } else { stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536); i += 4; } break; } if (stackClean) { stack.length = 0; } } } parse(charStringCode); } const NOOP = []; class Commands { cmds = []; add(cmd, args) { if (args) { if (!isNumberArray(args, null)) { warn(`Commands.add - "${cmd}" has at least one non-number arg: "${args}".`); const newArgs = args.map(arg => typeof arg === "number" ? arg : 0); this.cmds.push(cmd, ...newArgs); } else { this.cmds.push(cmd, ...args); } } else { this.cmds.push(cmd); } } } class CompiledFont { constructor(fontMatrix) { if (this.constructor === CompiledFont) { unreachable("Cannot initialize CompiledFont."); } this.fontMatrix = fontMatrix; this.compiledGlyphs = Object.create(null); this.compiledCharCodeToGlyphId = Object.create(null); } getPathJs(unicode) { const { charCode, glyphId } = lookupCmap(this.cmap, unicode); let fn = this.compiledGlyphs[glyphId], compileEx; if (!fn) { try { fn = this.compileGlyph(this.glyphs[glyphId], glyphId); } catch (ex) { fn = NOOP; compileEx = ex; } this.compiledGlyphs[glyphId] = fn; } this.compiledCharCodeToGlyphId[charCode] ??= glyphId; if (compileEx) { throw compileEx; } return fn; } compileGlyph(code, glyphId) { if (!code || code.length === 0 || code[0] === 14) { return NOOP; } let fontMatrix = this.fontMatrix; if (this.isCFFCIDFont) { const fdIndex = this.fdSelect.getFDIndex(glyphId); if (fdIndex >= 0 && fdIndex < this.fdArray.length) { const fontDict = this.fdArray[fdIndex]; fontMatrix = fontDict.getByName("FontMatrix") || FONT_IDENTITY_MATRIX; } else { warn("Invalid fd index for glyph index."); } } const cmds = new Commands(); cmds.add(FontRenderOps.SAVE); cmds.add(FontRenderOps.TRANSFORM, fontMatrix.slice()); cmds.add(FontRenderOps.SCALE); this.compileGlyphImpl(code, cmds, glyphId); cmds.add(FontRenderOps.RESTORE); return cmds.cmds; } compileGlyphImpl() { unreachable("Children classes should implement this."); } hasBuiltPath(unicode) { const { charCode, glyphId } = lookupCmap(this.cmap, unicode); return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined; } } class TrueTypeCompiled extends CompiledFont { constructor(glyphs, cmap, fontMatrix) { super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]); this.glyphs = glyphs; this.cmap = cmap; } compileGlyphImpl(code, cmds) { compileGlyf(code, cmds, this); } } class Type2Compiled extends CompiledFont { constructor(cffInfo, cmap, fontMatrix, glyphNameMap) { super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]); this.glyphs = cffInfo.glyphs; this.gsubrs = cffInfo.gsubrs || []; this.subrs = cffInfo.subrs || []; this.cmap = cmap; this.glyphNameMap = glyphNameMap || getGlyphsUnicode(); this.gsubrsBias = getSubroutineBias(this.gsubrs); this.subrsBias = getSubroutineBias(this.subrs); this.isCFFCIDFont = cffInfo.isCFFCIDFont; this.fdSelect = cffInfo.fdSelect; this.fdArray = cffInfo.fdArray; } compileGlyphImpl(code, cmds, glyphId) { compileCharString(code, cmds, this, glyphId); } } class FontRendererFactory { static create(font, seacAnalysisEnabled) { const data = new Uint8Array(font.data); let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm; const numTables = getUint16(data, 4); for (let i = 0, p = 12; i < numTables; i++, p += 16) { const tag = bytesToString(data.subarray(p, p + 4)); const offset = getUint32(data, p + 8); const length = getUint32(data, p + 12); switch (tag) { case "cmap": cmap = parseCmap(data, offset, offset + length); break; case "glyf": glyf = data.subarray(offset, offset + length); break; case "loca": loca = data.subarray(offset, offset + length); break; case "head": unitsPerEm = getUint16(data, offset + 18); indexToLocFormat = getUint16(data, offset + 50); break; case "CFF ": cff = parseCff(data, offset, offset + length, seacAnalysisEnabled); break; } } if (glyf) { const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0]; return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix); } return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap); } } ;// CONCATENATED MODULE: ./src/core/metrics.js const getMetrics = getLookupTableFactory(function (t) { t.Courier = 600; t["Courier-Bold"] = 600; t["Courier-BoldOblique"] = 600; t["Courier-Oblique"] = 600; t.Helvetica = getLookupTableFactory(function (t) { t.space = 278; t.exclam = 278; t.quotedbl = 355; t.numbersign = 556; t.dollar = 556; t.percent = 889; t.ampersand = 667; t.quoteright = 222; t.parenleft = 333; t.parenright = 333; t.asterisk = 389; t.plus = 584; t.comma = 278; t.hyphen = 333; t.period = 278; t.slash = 278; t.zero = 556; t.one = 556; t.two = 556; t.three = 556; t.four = 556; t.five = 556; t.six = 556; t.seven = 556; t.eight = 556; t.nine = 556; t.colon = 278; t.semicolon = 278; t.less = 584; t.equal = 584; t.greater = 584; t.question = 556; t.at = 1015; t.A = 667; t.B = 667; t.C = 722; t.D = 722; t.E = 667; t.F = 611; t.G = 778; t.H = 722; t.I = 278; t.J = 500; t.K = 667; t.L = 556; t.M = 833; t.N = 722; t.O = 778; t.P = 667; t.Q = 778; t.R = 722; t.S = 667; t.T = 611; t.U = 722; t.V = 667; t.W = 944; t.X = 667; t.Y = 667; t.Z = 611; t.bracketleft = 278; t.backslash = 278; t.bracketright = 278; t.asciicircum = 469; t.underscore = 556; t.quoteleft = 222; t.a = 556; t.b = 556; t.c = 500; t.d = 556; t.e = 556; t.f = 278; t.g = 556; t.h = 556; t.i = 222; t.j = 222; t.k = 500; t.l = 222; t.m = 833; t.n = 556; t.o = 556; t.p = 556; t.q = 556; t.r = 333; t.s = 500; t.t = 278; t.u = 556; t.v = 500; t.w = 722; t.x = 500; t.y = 500; t.z = 500; t.braceleft = 334; t.bar = 260; t.braceright = 334; t.asciitilde = 584; t.exclamdown = 333; t.cent = 556; t.sterling = 556; t.fraction = 167; t.yen = 556; t.florin = 556; t.section = 556; t.currency = 556; t.quotesingle = 191; t.quotedblleft = 333; t.guillemotleft = 556; t.guilsinglleft = 333; t.guilsinglright = 333; t.fi = 500; t.fl = 500; t.endash = 556; t.dagger = 556; t.daggerdbl = 556; t.periodcentered = 278; t.paragraph = 537; t.bullet = 350; t.quotesinglbase = 222; t.quotedblbase = 333; t.quotedblright = 333; t.guillemotright = 556; t.ellipsis = 1000; t.perthousand = 1000; t.questiondown = 611; t.grave = 333; t.acute = 333; t.circumflex = 333; t.tilde = 333; t.macron = 333; t.breve = 333; t.dotaccent = 333; t.dieresis = 333; t.ring = 333; t.cedilla = 333; t.hungarumlaut = 333; t.ogonek = 333; t.caron = 333; t.emdash = 1000; t.AE = 1000; t.ordfeminine = 370; t.Lslash = 556; t.Oslash = 778; t.OE = 1000; t.ordmasculine = 365; t.ae = 889; t.dotlessi = 278; t.lslash = 222; t.oslash = 611; t.oe = 944; t.germandbls = 611; t.Idieresis = 278; t.eacute = 556; t.abreve = 556; t.uhungarumlaut = 556; t.ecaron = 556; t.Ydieresis = 667; t.divide = 584; t.Yacute = 667; t.Acircumflex = 667; t.aacute = 556; t.Ucircumflex = 722; t.yacute = 500; t.scommaaccent = 500; t.ecircumflex = 556; t.Uring = 722; t.Udieresis = 722; t.aogonek = 556; t.Uacute = 722; t.uogonek = 556; t.Edieresis = 667; t.Dcroat = 722; t.commaaccent = 250; t.copyright = 737; t.Emacron = 667; t.ccaron = 500; t.aring = 556; t.Ncommaaccent = 722; t.lacute = 222; t.agrave = 556; t.Tcommaaccent = 611; t.Cacute = 722; t.atilde = 556; t.Edotaccent = 667; t.scaron = 500; t.scedilla = 500; t.iacute = 278; t.lozenge = 471; t.Rcaron = 722; t.Gcommaaccent = 778; t.ucircumflex = 556; t.acircumflex = 556; t.Amacron = 667; t.rcaron = 333; t.ccedilla = 500; t.Zdotaccent = 611; t.Thorn = 667; t.Omacron = 778; t.Racute = 722; t.Sacute = 667; t.dcaron = 643; t.Umacron = 722; t.uring = 556; t.threesuperior = 333; t.Ograve = 778; t.Agrave = 667; t.Abreve = 667; t.multiply = 584; t.uacute = 556; t.Tcaron = 611; t.partialdiff = 476; t.ydieresis = 500; t.Nacute = 722; t.icircumflex = 278; t.Ecircumflex = 667; t.adieresis = 556; t.edieresis = 556; t.cacute = 500; t.nacute = 556; t.umacron = 556; t.Ncaron = 722; t.Iacute = 278; t.plusminus = 584; t.brokenbar = 260; t.registered = 737; t.Gbreve = 778; t.Idotaccent = 278; t.summation = 600; t.Egrave = 667; t.racute = 333; t.omacron = 556; t.Zacute = 611; t.Zcaron = 611; t.greaterequal = 549; t.Eth = 722; t.Ccedilla = 722; t.lcommaaccent = 222; t.tcaron = 317; t.eogonek = 556; t.Uogonek = 722; t.Aacute = 667; t.Adieresis = 667; t.egrave = 556; t.zacute = 500; t.iogonek = 222; t.Oacute = 778; t.oacute = 556; t.amacron = 556; t.sacute = 500; t.idieresis = 278; t.Ocircumflex = 778; t.Ugrave = 722; t.Delta = 612; t.thorn = 556; t.twosuperior = 333; t.Odieresis = 778; t.mu = 556; t.igrave = 278; t.ohungarumlaut = 556; t.Eogonek = 667; t.dcroat = 556; t.threequarters = 834; t.Scedilla = 667; t.lcaron = 299; t.Kcommaaccent = 667; t.Lacute = 556; t.trademark = 1000; t.edotaccent = 556; t.Igrave = 278; t.Imacron = 278; t.Lcaron = 556; t.onehalf = 834; t.lessequal = 549; t.ocircumflex = 556; t.ntilde = 556; t.Uhungarumlaut = 722; t.Eacute = 667; t.emacron = 556; t.gbreve = 556; t.onequarter = 834; t.Scaron = 667; t.Scommaaccent = 667; t.Ohungarumlaut = 778; t.degree = 400; t.ograve = 556; t.Ccaron = 722; t.ugrave = 556; t.radical = 453; t.Dcaron = 722; t.rcommaaccent = 333; t.Ntilde = 722; t.otilde = 556; t.Rcommaaccent = 722; t.Lcommaaccent = 556; t.Atilde = 667; t.Aogonek = 667; t.Aring = 667; t.Otilde = 778; t.zdotaccent = 500; t.Ecaron = 667; t.Iogonek = 278; t.kcommaaccent = 500; t.minus = 584; t.Icircumflex = 278; t.ncaron = 556; t.tcommaaccent = 278; t.logicalnot = 584; t.odieresis = 556; t.udieresis = 556; t.notequal = 549; t.gcommaaccent = 556; t.eth = 556; t.zcaron = 500; t.ncommaaccent = 556; t.onesuperior = 333; t.imacron = 278; t.Euro = 556; }); t["Helvetica-Bold"] = getLookupTableFactory(function (t) { t.space = 278; t.exclam = 333; t.quotedbl = 474; t.numbersign = 556; t.dollar = 556; t.percent = 889; t.ampersand = 722; t.quoteright = 278; t.parenleft = 333; t.parenright = 333; t.asterisk = 389; t.plus = 584; t.comma = 278; t.hyphen = 333; t.period = 278; t.slash = 278; t.zero = 556; t.one = 556; t.two = 556; t.three = 556; t.four = 556; t.five = 556; t.six = 556; t.seven = 556; t.eight = 556; t.nine = 556; t.colon = 333; t.semicolon = 333; t.less = 584; t.equal = 584; t.greater = 584; t.question = 611; t.at = 975; t.A = 722; t.B = 722; t.C = 722; t.D = 722; t.E = 667; t.F = 611; t.G = 778; t.H = 722; t.I = 278; t.J = 556; t.K = 722; t.L = 611; t.M = 833; t.N = 722; t.O = 778; t.P = 667; t.Q = 778; t.R = 722; t.S = 667; t.T = 611; t.U = 722; t.V = 667; t.W = 944; t.X = 667; t.Y = 667; t.Z = 611; t.bracketleft = 333; t.backslash = 278; t.bracketright = 333; t.asciicircum = 584; t.underscore = 556; t.quoteleft = 278; t.a = 556; t.b = 611; t.c = 556; t.d = 611; t.e = 556; t.f = 333; t.g = 611; t.h = 611; t.i = 278; t.j = 278; t.k = 556; t.l = 278; t.m = 889; t.n = 611; t.o = 611; t.p = 611; t.q = 611; t.r = 389; t.s = 556; t.t = 333; t.u = 611; t.v = 556; t.w = 778; t.x = 556; t.y = 556; t.z = 500; t.braceleft = 389; t.bar = 280; t.braceright = 389; t.asciitilde = 584; t.exclamdown = 333; t.cent = 556; t.sterling = 556; t.fraction = 167; t.yen = 556; t.florin = 556; t.section = 556; t.currency = 556; t.quotesingle = 238; t.quotedblleft = 500; t.guillemotleft = 556; t.guilsinglleft = 333; t.guilsinglright = 333; t.fi = 611; t.fl = 611; t.endash = 556; t.dagger = 556; t.daggerdbl = 556; t.periodcentered = 278; t.paragraph = 556; t.bullet = 350; t.quotesinglbase = 278; t.quotedblbase = 500; t.quotedblright = 500; t.guillemotright = 556; t.ellipsis = 1000; t.perthousand = 1000; t.questiondown = 611; t.grave = 333; t.acute = 333; t.circumflex = 333; t.tilde = 333; t.macron = 333; t.breve = 333; t.dotaccent = 333; t.dieresis = 333; t.ring = 333; t.cedilla = 333; t.hungarumlaut = 333; t.ogonek = 333; t.caron = 333; t.emdash = 1000; t.AE = 1000; t.ordfeminine = 370; t.Lslash = 611; t.Oslash = 778; t.OE = 1000; t.ordmasculine = 365; t.ae = 889; t.dotlessi = 278; t.lslash = 278; t.oslash = 611; t.oe = 944; t.germandbls = 611; t.Idieresis = 278; t.eacute = 556; t.abreve = 556; t.uhungarumlaut = 611; t.ecaron = 556; t.Ydieresis = 667; t.divide = 584; t.Yacute = 667; t.Acircumflex = 722; t.aacute = 556; t.Ucircumflex = 722; t.yacute = 556; t.scommaaccent = 556; t.ecircumflex = 556; t.Uring = 722; t.Udieresis = 722; t.aogonek = 556; t.Uacute = 722; t.uogonek = 611; t.Edieresis = 667; t.Dcroat = 722; t.commaaccent = 250; t.copyright = 737; t.Emacron = 667; t.ccaron = 556; t.aring = 556; t.Ncommaaccent = 722; t.lacute = 278; t.agrave = 556; t.Tcommaaccent = 611; t.Cacute = 722; t.atilde = 556; t.Edotaccent = 667; t.scaron = 556; t.scedilla = 556; t.iacute = 278; t.lozenge = 494; t.Rcaron = 722; t.Gcommaaccent = 778; t.ucircumflex = 611; t.acircumflex = 556; t.Amacron = 722; t.rcaron = 389; t.ccedilla = 556; t.Zdotaccent = 611; t.Thorn = 667; t.Omacron = 778; t.Racute = 722; t.Sacute = 667; t.dcaron = 743; t.Umacron = 722; t.uring = 611; t.threesuperior = 333; t.Ograve = 778; t.Agrave = 722; t.Abreve = 722; t.multiply = 584; t.uacute = 611; t.Tcaron = 611; t.partialdiff = 494; t.ydieresis = 556; t.Nacute = 722; t.icircumflex = 278; t.Ecircumflex = 667; t.adieresis = 556; t.edieresis = 556; t.cacute = 556; t.nacute = 611; t.umacron = 611; t.Ncaron = 722; t.Iacute = 278; t.plusminus = 584; t.brokenbar = 280; t.registered = 737; t.Gbreve = 778; t.Idotaccent = 278; t.summation = 600; t.Egrave = 667; t.racute = 389; t.omacron = 611; t.Zacute = 611; t.Zcaron = 611; t.greaterequal = 549; t.Eth = 722; t.Ccedilla = 722; t.lcommaaccent = 278; t.tcaron = 389; t.eogonek = 556; t.Uogonek = 722; t.Aacute = 722; t.Adieresis = 722; t.egrave = 556; t.zacute = 500; t.iogonek = 278; t.Oacute = 778; t.oacute = 611; t.amacron = 556; t.sacute = 556; t.idieresis = 278; t.Ocircumflex = 778; t.Ugrave = 722; t.Delta = 612; t.thorn = 611; t.twosuperior = 333; t.Odieresis = 778; t.mu = 611; t.igrave = 278; t.ohungarumlaut = 611; t.Eogonek = 667; t.dcroat = 611; t.threequarters = 834; t.Scedilla = 667; t.lcaron = 400; t.Kcommaaccent = 722; t.Lacute = 611; t.trademark = 1000; t.edotaccent = 556; t.Igrave = 278; t.Imacron = 278; t.Lcaron = 611; t.onehalf = 834; t.lessequal = 549; t.ocircumflex = 611; t.ntilde = 611; t.Uhungarumlaut = 722; t.Eacute = 667; t.emacron = 556; t.gbreve = 611; t.onequarter = 834; t.Scaron = 667; t.Scommaaccent = 667; t.Ohungarumlaut = 778; t.degree = 400; t.ograve = 611; t.Ccaron = 722; t.ugrave = 611; t.radical = 549; t.Dcaron = 722; t.rcommaaccent = 389; t.Ntilde = 722; t.otilde = 611; t.Rcommaaccent = 722; t.Lcommaaccent = 611; t.Atilde = 722; t.Aogonek = 722; t.Aring = 722; t.Otilde = 778; t.zdotaccent = 500; t.Ecaron = 667; t.Iogonek = 278; t.kcommaaccent = 556; t.minus = 584; t.Icircumflex = 278; t.ncaron = 611; t.tcommaaccent = 333; t.logicalnot = 584; t.odieresis = 611; t.udieresis = 611; t.notequal = 549; t.gcommaaccent = 611; t.eth = 611; t.zcaron = 500; t.ncommaaccent = 611; t.onesuperior = 333; t.imacron = 278; t.Euro = 556; }); t["Helvetica-BoldOblique"] = getLookupTableFactory(function (t) { t.space = 278; t.exclam = 333; t.quotedbl = 474; t.numbersign = 556; t.dollar = 556; t.percent = 889; t.ampersand = 722; t.quoteright = 278; t.parenleft = 333; t.parenright = 333; t.asterisk = 389; t.plus = 584; t.comma = 278; t.hyphen = 333; t.period = 278; t.slash = 278; t.zero = 556; t.one = 556; t.two = 556; t.three = 556; t.four = 556; t.five = 556; t.six = 556; t.seven = 556; t.eight = 556; t.nine = 556; t.colon = 333; t.semicolon = 333; t.less = 584; t.equal = 584; t.greater = 584; t.question = 611; t.at = 975; t.A = 722; t.B = 722; t.C = 722; t.D = 722; t.E = 667; t.F = 611; t.G = 778; t.H = 722; t.I = 278; t.J = 556; t.K = 722; t.L = 611; t.M = 833; t.N = 722; t.O = 778; t.P = 667; t.Q = 778; t.R = 722; t.S = 667; t.T = 611; t.U = 722; t.V = 667; t.W = 944; t.X = 667; t.Y = 667; t.Z = 611; t.bracketleft = 333; t.backslash = 278; t.bracketright = 333; t.asciicircum = 584; t.underscore = 556; t.quoteleft = 278; t.a = 556; t.b = 611; t.c = 556; t.d = 611; t.e = 556; t.f = 333; t.g = 611; t.h = 611; t.i = 278; t.j = 278; t.k = 556; t.l = 278; t.m = 889; t.n = 611; t.o = 611; t.p = 611; t.q = 611; t.r = 389; t.s = 556; t.t = 333; t.u = 611; t.v = 556; t.w = 778; t.x = 556; t.y = 556; t.z = 500; t.braceleft = 389; t.bar = 280; t.braceright = 389; t.asciitilde = 584; t.exclamdown = 333; t.cent = 556; t.sterling = 556; t.fraction = 167; t.yen = 556; t.florin = 556; t.section = 556; t.currency = 556; t.quotesingle = 238; t.quotedblleft = 500; t.guillemotleft = 556; t.guilsinglleft = 333; t.guilsinglright = 333; t.fi = 611; t.fl = 611; t.endash = 556; t.dagger = 556; t.daggerdbl = 556; t.periodcentered = 278; t.paragraph = 556; t.bullet = 350; t.quotesinglbase = 278; t.quotedblbase = 500; t.quotedblright = 500; t.guillemotright = 556; t.ellipsis = 1000; t.perthousand = 1000; t.questiondown = 611; t.grave = 333; t.acute = 333; t.circumflex = 333; t.tilde = 333; t.macron = 333; t.breve = 333; t.dotaccent = 333; t.dieresis = 333; t.ring = 333; t.cedilla = 333; t.hungarumlaut = 333; t.ogonek = 333; t.caron = 333; t.emdash = 1000; t.AE = 1000; t.ordfeminine = 370; t.Lslash = 611; t.Oslash = 778; t.OE = 1000; t.ordmasculine = 365; t.ae = 889; t.dotlessi = 278; t.lslash = 278; t.oslash = 611; t.oe = 944; t.germandbls = 611; t.Idieresis = 278; t.eacute = 556; t.abreve = 556; t.uhungarumlaut = 611; t.ecaron = 556; t.Ydieresis = 667; t.divide = 584; t.Yacute = 667; t.Acircumflex = 722; t.aacute = 556; t.Ucircumflex = 722; t.yacute = 556; t.scommaaccent = 556; t.ecircumflex = 556; t.Uring = 722; t.Udieresis = 722; t.aogonek = 556; t.Uacute = 722; t.uogonek = 611; t.Edieresis = 667; t.Dcroat = 722; t.commaaccent = 250; t.copyright = 737; t.Emacron = 667; t.ccaron = 556; t.aring = 556; t.Ncommaaccent = 722; t.lacute = 278; t.agrave = 556; t.Tcommaaccent = 611; t.Cacute = 722; t.atilde = 556; t.Edotaccent = 667; t.scaron = 556; t.scedilla = 556; t.iacute = 278; t.lozenge = 494; t.Rcaron = 722; t.Gcommaaccent = 778; t.ucircumflex = 611; t.acircumflex = 556; t.Amacron = 722; t.rcaron = 389; t.ccedilla = 556; t.Zdotaccent = 611; t.Thorn = 667; t.Omacron = 778; t.Racute = 722; t.Sacute = 667; t.dcaron = 743; t.Umacron = 722; t.uring = 611; t.threesuperior = 333; t.Ograve = 778; t.Agrave = 722; t.Abreve = 722; t.multiply = 584; t.uacute = 611; t.Tcaron = 611; t.partialdiff = 494; t.ydieresis = 556; t.Nacute = 722; t.icircumflex = 278; t.Ecircumflex = 667; t.adieresis = 556; t.edieresis = 556; t.cacute = 556; t.nacute = 611; t.umacron = 611; t.Ncaron = 722; t.Iacute = 278; t.plusminus = 584; t.brokenbar = 280; t.registered = 737; t.Gbreve = 778; t.Idotaccent = 278; t.summation = 600; t.Egrave = 667; t.racute = 389; t.omacron = 611; t.Zacute = 611; t.Zcaron = 611; t.greaterequal = 549; t.Eth = 722; t.Ccedilla = 722; t.lcommaaccent = 278; t.tcaron = 389; t.eogonek = 556; t.Uogonek = 722; t.Aacute = 722; t.Adieresis = 722; t.egrave = 556; t.zacute = 500; t.iogonek = 278; t.Oacute = 778; t.oacute = 611; t.amacron = 556; t.sacute = 556; t.idieresis = 278; t.Ocircumflex = 778; t.Ugrave = 722; t.Delta = 612; t.thorn = 611; t.twosuperior = 333; t.Odieresis = 778; t.mu = 611; t.igrave = 278; t.ohungarumlaut = 611; t.Eogonek = 667; t.dcroat = 611; t.threequarters = 834; t.Scedilla = 667; t.lcaron = 400; t.Kcommaaccent = 722; t.Lacute = 611; t.trademark = 1000; t.edotaccent = 556; t.Igrave = 278; t.Imacron = 278; t.Lcaron = 611; t.onehalf = 834; t.lessequal = 549; t.ocircumflex = 611; t.ntilde = 611; t.Uhungarumlaut = 722; t.Eacute = 667; t.emacron = 556; t.gbreve = 611; t.onequarter = 834; t.Scaron = 667; t.Scommaaccent = 667; t.Ohungarumlaut = 778; t.degree = 400; t.ograve = 611; t.Ccaron = 722; t.ugrave = 611; t.radical = 549; t.Dcaron = 722; t.rcommaaccent = 389; t.Ntilde = 722; t.otilde = 611; t.Rcommaaccent = 722; t.Lcommaaccent = 611; t.Atilde = 722; t.Aogonek = 722; t.Aring = 722; t.Otilde = 778; t.zdotaccent = 500; t.Ecaron = 667; t.Iogonek = 278; t.kcommaaccent = 556; t.minus = 584; t.Icircumflex = 278; t.ncaron = 611; t.tcommaaccent = 333; t.logicalnot = 584; t.odieresis = 611; t.udieresis = 611; t.notequal = 549; t.gcommaaccent = 611; t.eth = 611; t.zcaron = 500; t.ncommaaccent = 611; t.onesuperior = 333; t.imacron = 278; t.Euro = 556; }); t["Helvetica-Oblique"] = getLookupTableFactory(function (t) { t.space = 278; t.exclam = 278; t.quotedbl = 355; t.numbersign = 556; t.dollar = 556; t.percent = 889; t.ampersand = 667; t.quoteright = 222; t.parenleft = 333; t.parenright = 333; t.asterisk = 389; t.plus = 584; t.comma = 278; t.hyphen = 333; t.period = 278; t.slash = 278; t.zero = 556; t.one = 556; t.two = 556; t.three = 556; t.four = 556; t.five = 556; t.six = 556; t.seven = 556; t.eight = 556; t.nine = 556; t.colon = 278; t.semicolon = 278; t.less = 584; t.equal = 584; t.greater = 584; t.question = 556; t.at = 1015; t.A = 667; t.B = 667; t.C = 722; t.D = 722; t.E = 667; t.F = 611; t.G = 778; t.H = 722; t.I = 278; t.J = 500; t.K = 667; t.L = 556; t.M = 833; t.N = 722; t.O = 778; t.P = 667; t.Q = 778; t.R = 722; t.S = 667; t.T = 611; t.U = 722; t.V = 667; t.W = 944; t.X = 667; t.Y = 667; t.Z = 611; t.bracketleft = 278; t.backslash = 278; t.bracketright = 278; t.asciicircum = 469; t.underscore = 556; t.quoteleft = 222; t.a = 556; t.b = 556; t.c = 500; t.d = 556; t.e = 556; t.f = 278; t.g = 556; t.h = 556; t.i = 222; t.j = 222; t.k = 500; t.l = 222; t.m = 833; t.n = 556; t.o = 556; t.p = 556; t.q = 556; t.r = 333; t.s = 500; t.t = 278; t.u = 556; t.v = 500; t.w = 722; t.x = 500; t.y = 500; t.z = 500; t.braceleft = 334; t.bar = 260; t.braceright = 334; t.asciitilde = 584; t.exclamdown = 333; t.cent = 556; t.sterling = 556; t.fraction = 167; t.yen = 556; t.florin = 556; t.section = 556; t.currency = 556; t.quotesingle = 191; t.quotedblleft = 333; t.guillemotleft = 556; t.guilsinglleft = 333; t.guilsinglright = 333; t.fi = 500; t.fl = 500; t.endash = 556; t.dagger = 556; t.daggerdbl = 556; t.periodcentered = 278; t.paragraph = 537; t.bullet = 350; t.quotesinglbase = 222; t.quotedblbase = 333; t.quotedblright = 333; t.guillemotright = 556; t.ellipsis = 1000; t.perthousand = 1000; t.questiondown = 611; t.grave = 333; t.acute = 333; t.circumflex = 333; t.tilde = 333; t.macron = 333; t.breve = 333; t.dotaccent = 333; t.dieresis = 333; t.ring = 333; t.cedilla = 333; t.hungarumlaut = 333; t.ogonek = 333; t.caron = 333; t.emdash = 1000; t.AE = 1000; t.ordfeminine = 370; t.Lslash = 556; t.Oslash = 778; t.OE = 1000; t.ordmasculine = 365; t.ae = 889; t.dotlessi = 278; t.lslash = 222; t.oslash = 611; t.oe = 944; t.germandbls = 611; t.Idieresis = 278; t.eacute = 556; t.abreve = 556; t.uhungarumlaut = 556; t.ecaron = 556; t.Ydieresis = 667; t.divide = 584; t.Yacute = 667; t.Acircumflex = 667; t.aacute = 556; t.Ucircumflex = 722; t.yacute = 500; t.scommaaccent = 500; t.ecircumflex = 556; t.Uring = 722; t.Udieresis = 722; t.aogonek = 556; t.Uacute = 722; t.uogonek = 556; t.Edieresis = 667; t.Dcroat = 722; t.commaaccent = 250; t.copyright = 737; t.Emacron = 667; t.ccaron = 500; t.aring = 556; t.Ncommaaccent = 722; t.lacute = 222; t.agrave = 556; t.Tcommaaccent = 611; t.Cacute = 722; t.atilde = 556; t.Edotaccent = 667; t.scaron = 500; t.scedilla = 500; t.iacute = 278; t.lozenge = 471; t.Rcaron = 722; t.Gcommaaccent = 778; t.ucircumflex = 556; t.acircumflex = 556; t.Amacron = 667; t.rcaron = 333; t.ccedilla = 500; t.Zdotaccent = 611; t.Thorn = 667; t.Omacron = 778; t.Racute = 722; t.Sacute = 667; t.dcaron = 643; t.Umacron = 722; t.uring = 556; t.threesuperior = 333; t.Ograve = 778; t.Agrave = 667; t.Abreve = 667; t.multiply = 584; t.uacute = 556; t.Tcaron = 611; t.partialdiff = 476; t.ydieresis = 500; t.Nacute = 722; t.icircumflex = 278; t.Ecircumflex = 667; t.adieresis = 556; t.edieresis = 556; t.cacute = 500; t.nacute = 556; t.umacron = 556; t.Ncaron = 722; t.Iacute = 278; t.plusminus = 584; t.brokenbar = 260; t.registered = 737; t.Gbreve = 778; t.Idotaccent = 278; t.summation = 600; t.Egrave = 667; t.racute = 333; t.omacron = 556; t.Zacute = 611; t.Zcaron = 611; t.greaterequal = 549; t.Eth = 722; t.Ccedilla = 722; t.lcommaaccent = 222; t.tcaron = 317; t.eogonek = 556; t.Uogonek = 722; t.Aacute = 667; t.Adieresis = 667; t.egrave = 556; t.zacute = 500; t.iogonek = 222; t.Oacute = 778; t.oacute = 556; t.amacron = 556; t.sacute = 500; t.idieresis = 278; t.Ocircumflex = 778; t.Ugrave = 722; t.Delta = 612; t.thorn = 556; t.twosuperior = 333; t.Odieresis = 778; t.mu = 556; t.igrave = 278; t.ohungarumlaut = 556; t.Eogonek = 667; t.dcroat = 556; t.threequarters = 834; t.Scedilla = 667; t.lcaron = 299; t.Kcommaaccent = 667; t.Lacute = 556; t.trademark = 1000; t.edotaccent = 556; t.Igrave = 278; t.Imacron = 278; t.Lcaron = 556; t.onehalf = 834; t.lessequal = 549; t.ocircumflex = 556; t.ntilde = 556; t.Uhungarumlaut = 722; t.Eacute = 667; t.emacron = 556; t.gbreve = 556; t.onequarter = 834; t.Scaron = 667; t.Scommaaccent = 667; t.Ohungarumlaut = 778; t.degree = 400; t.ograve = 556; t.Ccaron = 722; t.ugrave = 556; t.radical = 453; t.Dcaron = 722; t.rcommaaccent = 333; t.Ntilde = 722; t.otilde = 556; t.Rcommaaccent = 722; t.Lcommaaccent = 556; t.Atilde = 667; t.Aogonek = 667; t.Aring = 667; t.Otilde = 778; t.zdotaccent = 500; t.Ecaron = 667; t.Iogonek = 278; t.kcommaaccent = 500; t.minus = 584; t.Icircumflex = 278; t.ncaron = 556; t.tcommaaccent = 278; t.logicalnot = 584; t.odieresis = 556; t.udieresis = 556; t.notequal = 549; t.gcommaaccent = 556; t.eth = 556; t.zcaron = 500; t.ncommaaccent = 556; t.onesuperior = 333; t.imacron = 278; t.Euro = 556; }); t.Symbol = getLookupTableFactory(function (t) { t.space = 250; t.exclam = 333; t.universal = 713; t.numbersign = 500; t.existential = 549; t.percent = 833; t.ampersand = 778; t.suchthat = 439; t.parenleft = 333; t.parenright = 333; t.asteriskmath = 500; t.plus = 549; t.comma = 250; t.minus = 549; t.period = 250; t.slash = 278; t.zero = 500; t.one = 500; t.two = 500; t.three = 500; t.four = 500; t.five = 500; t.six = 500; t.seven = 500; t.eight = 500; t.nine = 500; t.colon = 278; t.semicolon = 278; t.less = 549; t.equal = 549; t.greater = 549; t.question = 444; t.congruent = 549; t.Alpha = 722; t.Beta = 667; t.Chi = 722; t.Delta = 612; t.Epsilon = 611; t.Phi = 763; t.Gamma = 603; t.Eta = 722; t.Iota = 333; t.theta1 = 631; t.Kappa = 722; t.Lambda = 686; t.Mu = 889; t.Nu = 722; t.Omicron = 722; t.Pi = 768; t.Theta = 741; t.Rho = 556; t.Sigma = 592; t.Tau = 611; t.Upsilon = 690; t.sigma1 = 439; t.Omega = 768; t.Xi = 645; t.Psi = 795; t.Zeta = 611; t.bracketleft = 333; t.therefore = 863; t.bracketright = 333; t.perpendicular = 658; t.underscore = 500; t.radicalex = 500; t.alpha = 631; t.beta = 549; t.chi = 549; t.delta = 494; t.epsilon = 439; t.phi = 521; t.gamma = 411; t.eta = 603; t.iota = 329; t.phi1 = 603; t.kappa = 549; t.lambda = 549; t.mu = 576; t.nu = 521; t.omicron = 549; t.pi = 549; t.theta = 521; t.rho = 549; t.sigma = 603; t.tau = 439; t.upsilon = 576; t.omega1 = 713; t.omega = 686; t.xi = 493; t.psi = 686; t.zeta = 494; t.braceleft = 480; t.bar = 200; t.braceright = 480; t.similar = 549; t.Euro = 750; t.Upsilon1 = 620; t.minute = 247; t.lessequal = 549; t.fraction = 167; t.infinity = 713; t.florin = 500; t.club = 753; t.diamond = 753; t.heart = 753; t.spade = 753; t.arrowboth = 1042; t.arrowleft = 987; t.arrowup = 603; t.arrowright = 987; t.arrowdown = 603; t.degree = 400; t.plusminus = 549; t.second = 411; t.greaterequal = 549; t.multiply = 549; t.proportional = 713; t.partialdiff = 494; t.bullet = 460; t.divide = 549; t.notequal = 549; t.equivalence = 549; t.approxequal = 549; t.ellipsis = 1000; t.arrowvertex = 603; t.arrowhorizex = 1000; t.carriagereturn = 658; t.aleph = 823; t.Ifraktur = 686; t.Rfraktur = 795; t.weierstrass = 987; t.circlemultiply = 768; t.circleplus = 768; t.emptyset = 823; t.intersection = 768; t.union = 768; t.propersuperset = 713; t.reflexsuperset = 713; t.notsubset = 713; t.propersubset = 713; t.reflexsubset = 713; t.element = 713; t.notelement = 713; t.angle = 768; t.gradient = 713; t.registerserif = 790; t.copyrightserif = 790; t.trademarkserif = 890; t.product = 823; t.radical = 549; t.dotmath = 250; t.logicalnot = 713; t.logicaland = 603; t.logicalor = 603; t.arrowdblboth = 1042; t.arrowdblleft = 987; t.arrowdblup = 603; t.arrowdblright = 987; t.arrowdbldown = 603; t.lozenge = 494; t.angleleft = 329; t.registersans = 790; t.copyrightsans = 790; t.trademarksans = 786; t.summation = 713; t.parenlefttp = 384; t.parenleftex = 384; t.parenleftbt = 384; t.bracketlefttp = 384; t.bracketleftex = 384; t.bracketleftbt = 384; t.bracelefttp = 494; t.braceleftmid = 494; t.braceleftbt = 494; t.braceex = 494; t.angleright = 329; t.integral = 274; t.integraltp = 686; t.integralex = 686; t.integralbt = 686; t.parenrighttp = 384; t.parenrightex = 384; t.parenrightbt = 384; t.bracketrighttp = 384; t.bracketrightex = 384; t.bracketrightbt = 384; t.bracerighttp = 494; t.bracerightmid = 494; t.bracerightbt = 494; t.apple = 790; }); t["Times-Roman"] = getLookupTableFactory(function (t) { t.space = 250; t.exclam = 333; t.quotedbl = 408; t.numbersign = 500; t.dollar = 500; t.percent = 833; t.ampersand = 778; t.quoteright = 333; t.parenleft = 333; t.parenright = 333; t.asterisk = 500; t.plus = 564; t.comma = 250; t.hyphen = 333; t.period = 250; t.slash = 278; t.zero = 500; t.one = 500; t.two = 500; t.three = 500; t.four = 500; t.five = 500; t.six = 500; t.seven = 500; t.eight = 500; t.nine = 500; t.colon = 278; t.semicolon = 278; t.less = 564; t.equal = 564; t.greater = 564; t.question = 444; t.at = 921; t.A = 722; t.B = 667; t.C = 667; t.D = 722; t.E = 611; t.F = 556; t.G = 722; t.H = 722; t.I = 333; t.J = 389; t.K = 722; t.L = 611; t.M = 889; t.N = 722; t.O = 722; t.P = 556; t.Q = 722; t.R = 667; t.S = 556; t.T = 611; t.U = 722; t.V = 722; t.W = 944; t.X = 722; t.Y = 722; t.Z = 611; t.bracketleft = 333; t.backslash = 278; t.bracketright = 333; t.asciicircum = 469; t.underscore = 500; t.quoteleft = 333; t.a = 444; t.b = 500; t.c = 444; t.d = 500; t.e = 444; t.f = 333; t.g = 500; t.h = 500; t.i = 278; t.j = 278; t.k = 500; t.l = 278; t.m = 778; t.n = 500; t.o = 500; t.p = 500; t.q = 500; t.r = 333; t.s = 389; t.t = 278; t.u = 500; t.v = 500; t.w = 722; t.x = 500; t.y = 500; t.z = 444; t.braceleft = 480; t.bar = 200; t.braceright = 480; t.asciitilde = 541; t.exclamdown = 333; t.cent = 500; t.sterling = 500; t.fraction = 167; t.yen = 500; t.florin = 500; t.section = 500; t.currency = 500; t.quotesingle = 180; t.quotedblleft = 444; t.guillemotleft = 500; t.guilsinglleft = 333; t.guilsinglright = 333; t.fi = 556; t.fl = 556; t.endash = 500; t.dagger = 500; t.daggerdbl = 500; t.periodcentered = 250; t.paragraph = 453; t.bullet = 350; t.quotesinglbase = 333; t.quotedblbase = 444; t.quotedblright = 444; t.guillemotright = 500; t.ellipsis = 1000; t.perthousand = 1000; t.questiondown = 444; t.grave = 333; t.acute = 333; t.circumflex = 333; t.tilde = 333; t.macron = 333; t.breve = 333; t.dotaccent = 333; t.dieresis = 333; t.ring = 333; t.cedilla = 333; t.hungarumlaut = 333; t.ogonek = 333; t.caron = 333; t.emdash = 1000; t.AE = 889; t.ordfeminine = 276; t.Lslash = 611; t.Oslash = 722; t.OE = 889; t.ordmasculine = 310; t.ae = 667; t.dotlessi = 278; t.lslash = 278; t.oslash = 500; t.oe = 722; t.germandbls = 500; t.Idieresis = 333; t.eacute = 444; t.abreve = 444; t.uhungarumlaut = 500; t.ecaron = 444; t.Ydieresis = 722; t.divide = 564; t.Yacute = 722; t.Acircumflex = 722; t.aacute = 444; t.Ucircumflex = 722; t.yacute = 500; t.scommaaccent = 389; t.ecircumflex = 444; t.Uring = 722; t.Udieresis = 722; t.aogonek = 444; t.Uacute = 722; t.uogonek = 500; t.Edieresis = 611; t.Dcroat = 722; t.commaaccent = 250; t.copyright = 760; t.Emacron = 611; t.ccaron = 444; t.aring = 444; t.Ncommaaccent = 722; t.lacute = 278; t.agrave = 444; t.Tcommaaccent = 611; t.Cacute = 667; t.atilde = 444; t.Edotaccent = 611; t.scaron = 389; t.scedilla = 389; t.iacute = 278; t.lozenge = 471; t.Rcaron = 667; t.Gcommaaccent = 722; t.ucircumflex = 500; t.acircumflex = 444; t.Amacron = 722; t.rcaron = 333; t.ccedilla = 444; t.Zdotaccent = 611; t.Thorn = 556; t.Omacron = 722; t.Racute = 667; t.Sacute = 556; t.dcaron = 588; t.Umacron = 722; t.uring = 500; t.threesuperior = 300; t.Ograve = 722; t.Agrave = 722; t.Abreve = 722; t.multiply = 564; t.uacute = 500; t.Tcaron = 611; t.partialdiff = 476; t.ydieresis = 500; t.Nacute = 722; t.icircumflex = 278; t.Ecircumflex = 611; t.adieresis = 444; t.edieresis = 444; t.cacute = 444; t.nacute = 500; t.umacron = 500; t.Ncaron = 722; t.Iacute = 333; t.plusminus = 564; t.brokenbar = 200; t.registered = 760; t.Gbreve = 722; t.Idotaccent = 333; t.summation = 600; t.Egrave = 611; t.racute = 333; t.omacron = 500; t.Zacute = 611; t.Zcaron = 611; t.greaterequal = 549; t.Eth = 722; t.Ccedilla = 667; t.lcommaaccent = 278; t.tcaron = 326; t.eogonek = 444; t.Uogonek = 722; t.Aacute = 722; t.Adieresis = 722; t.egrave = 444; t.zacute = 444; t.iogonek = 278; t.Oacute = 722; t.oacute = 500; t.amacron = 444; t.sacute = 389; t.idieresis = 278; t.Ocircumflex = 722; t.Ugrave = 722; t.Delta = 612; t.thorn = 500; t.twosuperior = 300; t.Odieresis = 722; t.mu = 500; t.igrave = 278; t.ohungarumlaut = 500; t.Eogonek = 611; t.dcroat = 500; t.threequarters = 750; t.Scedilla = 556; t.lcaron = 344; t.Kcommaaccent = 722; t.Lacute = 611; t.trademark = 980; t.edotaccent = 444; t.Igrave = 333; t.Imacron = 333; t.Lcaron = 611; t.onehalf = 750; t.lessequal = 549; t.ocircumflex = 500; t.ntilde = 500; t.Uhungarumlaut = 722; t.Eacute = 611; t.emacron = 444; t.gbreve = 500; t.onequarter = 750; t.Scaron = 556; t.Scommaaccent = 556; t.Ohungarumlaut = 722; t.degree = 400; t.ograve = 500; t.Ccaron = 667; t.ugrave = 500; t.radical = 453; t.Dcaron = 722; t.rcommaaccent = 333; t.Ntilde = 722; t.otilde = 500; t.Rcommaaccent = 667; t.Lcommaaccent = 611; t.Atilde = 722; t.Aogonek = 722; t.Aring = 722; t.Otilde = 722; t.zdotaccent = 444; t.Ecaron = 611; t.Iogonek = 333; t.kcommaaccent = 500; t.minus = 564; t.Icircumflex = 333; t.ncaron = 500; t.tcommaaccent = 278; t.logicalnot = 564; t.odieresis = 500; t.udieresis = 500; t.notequal = 549; t.gcommaaccent = 500; t.eth = 500; t.zcaron = 444; t.ncommaaccent = 500; t.onesuperior = 300; t.imacron = 278; t.Euro = 500; }); t["Times-Bold"] = getLookupTableFactory(function (t) { t.space = 250; t.exclam = 333; t.quotedbl = 555; t.numbersign = 500; t.dollar = 500; t.percent = 1000; t.ampersand = 833; t.quoteright = 333; t.parenleft = 333; t.parenright = 333; t.asterisk = 500; t.plus = 570; t.comma = 250; t.hyphen = 333; t.period = 250; t.slash = 278; t.zero = 500; t.one = 500; t.two = 500; t.three = 500; t.four = 500; t.five = 500; t.six = 500; t.seven = 500; t.eight = 500; t.nine = 500; t.colon = 333; t.semicolon = 333; t.less = 570; t.equal = 570; t.greater = 570; t.question = 500; t.at = 930; t.A = 722; t.B = 667; t.C = 722; t.D = 722; t.E = 667; t.F = 611; t.G = 778; t.H = 778; t.I = 389; t.J = 500; t.K = 778; t.L = 667; t.M = 944; t.N = 722; t.O = 778; t.P = 611; t.Q = 778; t.R = 722; t.S = 556; t.T = 667; t.U = 722; t.V = 722; t.W = 1000; t.X = 722; t.Y = 722; t.Z = 667; t.bracketleft = 333; t.backslash = 278; t.bracketright = 333; t.asciicircum = 581; t.underscore = 500; t.quoteleft = 333; t.a = 500; t.b = 556; t.c = 444; t.d = 556; t.e = 444; t.f = 333; t.g = 500; t.h = 556; t.i = 278; t.j = 333; t.k = 556; t.l = 278; t.m = 833; t.n = 556; t.o = 500; t.p = 556; t.q = 556; t.r = 444; t.s = 389; t.t = 333; t.u = 556; t.v = 500; t.w = 722; t.x = 500; t.y = 500; t.z = 444; t.braceleft = 394; t.bar = 220; t.braceright = 394; t.asciitilde = 520; t.exclamdown = 333; t.cent = 500; t.sterling = 500; t.fraction = 167; t.yen = 500; t.florin = 500; t.section = 500; t.currency = 500; t.quotesingle = 278; t.quotedblleft = 500; t.guillemotleft = 500; t.guilsinglleft = 333; t.guilsinglright = 333; t.fi = 556; t.fl = 556; t.endash = 500; t.dagger = 500; t.daggerdbl = 500; t.periodcentered = 250; t.paragraph = 540; t.bullet = 350; t.quotesinglbase = 333; t.quotedblbase = 500; t.quotedblright = 500; t.guillemotright = 500; t.ellipsis = 1000; t.perthousand = 1000; t.questiondown = 500; t.grave = 333; t.acute = 333; t.circumflex = 333; t.tilde = 333; t.macron = 333; t.breve = 333; t.dotaccent = 333; t.dieresis = 333; t.ring = 333; t.cedilla = 333; t.hungarumlaut = 333; t.ogonek = 333; t.caron = 333; t.emdash = 1000; t.AE = 1000; t.ordfeminine = 300; t.Lslash = 667; t.Oslash = 778; t.OE = 1000; t.ordmasculine = 330; t.ae = 722; t.dotlessi = 278; t.lslash = 278; t.oslash = 500; t.oe = 722; t.germandbls = 556; t.Idieresis = 389; t.eacute = 444; t.abreve = 500; t.uhungarumlaut = 556; t.ecaron = 444; t.Ydieresis = 722; t.divide = 570; t.Yacute = 722; t.Acircumflex = 722; t.aacute = 500; t.Ucircumflex = 722; t.yacute = 500; t.scommaaccent = 389; t.ecircumflex = 444; t.Uring = 722; t.Udieresis = 722; t.aogonek = 500; t.Uacute = 722; t.uogonek = 556; t.Edieresis = 667; t.Dcroat = 722; t.commaaccent = 250; t.copyright = 747; t.Emacron = 667; t.ccaron = 444; t.aring = 500; t.Ncommaaccent = 722; t.lacute = 278; t.agrave = 500; t.Tcommaaccent = 667; t.Cacute = 722; t.atilde = 500; t.Edotaccent = 667; t.scaron = 389; t.scedilla = 389; t.iacute = 278; t.lozenge = 494; t.Rcaron = 722; t.Gcommaaccent = 778; t.ucircumflex = 556; t.acircumflex = 500; t.Amacron = 722; t.rcaron = 444; t.ccedilla = 444; t.Zdotaccent = 667; t.Thorn = 611; t.Omacron = 778; t.Racute = 722; t.Sacute = 556; t.dcaron = 672; t.Umacron = 722; t.uring = 556; t.threesuperior = 300; t.Ograve = 778; t.Agrave = 722; t.Abreve = 722; t.multiply = 570; t.uacute = 556; t.Tcaron = 667; t.partialdiff = 494; t.ydieresis = 500; t.Nacute = 722; t.icircumflex = 278; t.Ecircumflex = 667; t.adieresis = 500; t.edieresis = 444; t.cacute = 444; t.nacute = 556; t.umacron = 556; t.Ncaron = 722; t.Iacute = 389; t.plusminus = 570; t.brokenbar = 220; t.registered = 747; t.Gbreve = 778; t.Idotaccent = 389; t.summation = 600; t.Egrave = 667; t.racute = 444; t.omacron = 500; t.Zacute = 667; t.Zcaron = 667; t.greaterequal = 549; t.Eth = 722; t.Ccedilla = 722; t.lcommaaccent = 278; t.tcaron = 416; t.eogonek = 444; t.Uogonek = 722; t.Aacute = 722; t.Adieresis = 722; t.egrave = 444; t.zacute = 444; t.iogonek = 278; t.Oacute = 778; t.oacute = 500; t.amacron = 500; t.sacute = 389; t.idieresis = 278; t.Ocircumflex = 778; t.Ugrave = 722; t.Delta = 612; t.thorn = 556; t.twosuperior = 300; t.Odieresis = 778; t.mu = 556; t.igrave = 278; t.ohungarumlaut = 500; t.Eogonek = 667; t.dcroat = 556; t.threequarters = 750; t.Scedilla = 556; t.lcaron = 394; t.Kcommaaccent = 778; t.Lacute = 667; t.trademark = 1000; t.edotaccent = 444; t.Igrave = 389; t.Imacron = 389; t.Lcaron = 667; t.onehalf = 750; t.lessequal = 549; t.ocircumflex = 500; t.ntilde = 556; t.Uhungarumlaut = 722; t.Eacute = 667; t.emacron = 444; t.gbreve = 500; t.onequarter = 750; t.Scaron = 556; t.Scommaaccent = 556; t.Ohungarumlaut = 778; t.degree = 400; t.ograve = 500; t.Ccaron = 722; t.ugrave = 556; t.radical = 549; t.Dcaron = 722; t.rcommaaccent = 444; t.Ntilde = 722; t.otilde = 500; t.Rcommaaccent = 722; t.Lcommaaccent = 667; t.Atilde = 722; t.Aogonek = 722; t.Aring = 722; t.Otilde = 778; t.zdotaccent = 444; t.Ecaron = 667; t.Iogonek = 389; t.kcommaaccent = 556; t.minus = 570; t.Icircumflex = 389; t.ncaron = 556; t.tcommaaccent = 333; t.logicalnot = 570; t.odieresis = 500; t.udieresis = 556; t.notequal = 549; t.gcommaaccent = 500; t.eth = 500; t.zcaron = 444; t.ncommaaccent = 556; t.onesuperior = 300; t.imacron = 278; t.Euro = 500; }); t["Times-BoldItalic"] = getLookupTableFactory(function (t) { t.space = 250; t.exclam = 389; t.quotedbl = 555; t.numbersign = 500; t.dollar = 500; t.percent = 833; t.ampersand = 778; t.quoteright = 333; t.parenleft = 333; t.parenright = 333; t.asterisk = 500; t.plus = 570; t.comma = 250; t.hyphen = 333; t.period = 250; t.slash = 278; t.zero = 500; t.one = 500; t.two = 500; t.three = 500; t.four = 500; t.five = 500; t.six = 500; t.seven = 500; t.eight = 500; t.nine = 500; t.colon = 333; t.semicolon = 333; t.less = 570; t.equal = 570; t.greater = 570; t.question = 500; t.at = 832; t.A = 667; t.B = 667; t.C = 667; t.D = 722; t.E = 667; t.F = 667; t.G = 722; t.H = 778; t.I = 389; t.J = 500; t.K = 667; t.L = 611; t.M = 889; t.N = 722; t.O = 722; t.P = 611; t.Q = 722; t.R = 667; t.S = 556; t.T = 611; t.U = 722; t.V = 667; t.W = 889; t.X = 667; t.Y = 611; t.Z = 611; t.bracketleft = 333; t.backslash = 278; t.bracketright = 333; t.asciicircum = 570; t.underscore = 500; t.quoteleft = 333; t.a = 500; t.b = 500; t.c = 444; t.d = 500; t.e = 444; t.f = 333; t.g = 500; t.h = 556; t.i = 278; t.j = 278; t.k = 500; t.l = 278; t.m = 778; t.n = 556; t.o = 500; t.p = 500; t.q = 500; t.r = 389; t.s = 389; t.t = 278; t.u = 556; t.v = 444; t.w = 667; t.x = 500; t.y = 444; t.z = 389; t.braceleft = 348; t.bar = 220; t.braceright = 348; t.asciitilde = 570; t.exclamdown = 389; t.cent = 500; t.sterling = 500; t.fraction = 167; t.yen = 500; t.florin = 500; t.section = 500; t.currency = 500; t.quotesingle = 278; t.quotedblleft = 500; t.guillemotleft = 500; t.guilsinglleft = 333; t.guilsinglright = 333; t.fi = 556; t.fl = 556; t.endash = 500; t.dagger = 500; t.daggerdbl = 500; t.periodcentered = 250; t.paragraph = 500; t.bullet = 350; t.quotesinglbase = 333; t.quotedblbase = 500; t.quotedblright = 500; t.guillemotright = 500; t.ellipsis = 1000; t.perthousand = 1000; t.questiondown = 500; t.grave = 333; t.acute = 333; t.circumflex = 333; t.tilde = 333; t.macron = 333; t.breve = 333; t.dotaccent = 333; t.dieresis = 333; t.ring = 333; t.cedilla = 333; t.hungarumlaut = 333; t.ogonek = 333; t.caron = 333; t.emdash = 1000; t.AE = 944; t.ordfeminine = 266; t.Lslash = 611; t.Oslash = 722; t.OE = 944; t.ordmasculine = 300; t.ae = 722; t.dotlessi = 278; t.lslash = 278; t.oslash = 500; t.oe = 722; t.germandbls = 500; t.Idieresis = 389; t.eacute = 444; t.abreve = 500; t.uhungarumlaut = 556; t.ecaron = 444; t.Ydieresis = 611; t.divide = 570; t.Yacute = 611; t.Acircumflex = 667; t.aacute = 500; t.Ucircumflex = 722; t.yacute = 444; t.scommaaccent = 389; t.ecircumflex = 444; t.Uring = 722; t.Udieresis = 722; t.aogonek = 500; t.Uacute = 722; t.uogonek = 556; t.Edieresis = 667; t.Dcroat = 722; t.commaaccent = 250; t.copyright = 747; t.Emacron = 667; t.ccaron = 444; t.aring = 500; t.Ncommaaccent = 722; t.lacute = 278; t.agrave = 500; t.Tcommaaccent = 611; t.Cacute = 667; t.atilde = 500; t.Edotaccent = 667; t.scaron = 389; t.scedilla = 389; t.iacute = 278; t.lozenge = 494; t.Rcaron = 667; t.Gcommaaccent = 722; t.ucircumflex = 556; t.acircumflex = 500; t.Amacron = 667; t.rcaron = 389; t.ccedilla = 444; t.Zdotaccent = 611; t.Thorn = 611; t.Omacron = 722; t.Racute = 667; t.Sacute = 556; t.dcaron = 608; t.Umacron = 722; t.uring = 556; t.threesuperior = 300; t.Ograve = 722; t.Agrave = 667; t.Abreve = 667; t.multiply = 570; t.uacute = 556; t.Tcaron = 611; t.partialdiff = 494; t.ydieresis = 444; t.Nacute = 722; t.icircumflex = 278; t.Ecircumflex = 667; t.adieresis = 500; t.edieresis = 444; t.cacute = 444; t.nacute = 556; t.umacron = 556; t.Ncaron = 722; t.Iacute = 389; t.plusminus = 570; t.brokenbar = 220; t.registered = 747; t.Gbreve = 722; t.Idotaccent = 389; t.summation = 600; t.Egrave = 667; t.racute = 389; t.omacron = 500; t.Zacute = 611; t.Zcaron = 611; t.greaterequal = 549; t.Eth = 722; t.Ccedilla = 667; t.lcommaaccent = 278; t.tcaron = 366; t.eogonek = 444; t.Uogonek = 722; t.Aacute = 667; t.Adieresis = 667; t.egrave = 444; t.zacute = 389; t.iogonek = 278; t.Oacute = 722; t.oacute = 500; t.amacron = 500; t.sacute = 389; t.idieresis = 278; t.Ocircumflex = 722; t.Ugrave = 722; t.Delta = 612; t.thorn = 500; t.twosuperior = 300; t.Odieresis = 722; t.mu = 576; t.igrave = 278; t.ohungarumlaut = 500; t.Eogonek = 667; t.dcroat = 500; t.threequarters = 750; t.Scedilla = 556; t.lcaron = 382; t.Kcommaaccent = 667; t.Lacute = 611; t.trademark = 1000; t.edotaccent = 444; t.Igrave = 389; t.Imacron = 389; t.Lcaron = 611; t.onehalf = 750; t.lessequal = 549; t.ocircumflex = 500; t.ntilde = 556; t.Uhungarumlaut = 722; t.Eacute = 667; t.emacron = 444; t.gbreve = 500; t.onequarter = 750; t.Scaron = 556; t.Scommaaccent = 556; t.Ohungarumlaut = 722; t.degree = 400; t.ograve = 500; t.Ccaron = 667; t.ugrave = 556; t.radical = 549; t.Dcaron = 722; t.rcommaaccent = 389; t.Ntilde = 722; t.otilde = 500; t.Rcommaaccent = 667; t.Lcommaaccent = 611; t.Atilde = 667; t.Aogonek = 667; t.Aring = 667; t.Otilde = 722; t.zdotaccent = 389; t.Ecaron = 667; t.Iogonek = 389; t.kcommaaccent = 500; t.minus = 606; t.Icircumflex = 389; t.ncaron = 556; t.tcommaaccent = 278; t.logicalnot = 606; t.odieresis = 500; t.udieresis = 556; t.notequal = 549; t.gcommaaccent = 500; t.eth = 500; t.zcaron = 389; t.ncommaaccent = 556; t.onesuperior = 300; t.imacron = 278; t.Euro = 500; }); t["Times-Italic"] = getLookupTableFactory(function (t) { t.space = 250; t.exclam = 333; t.quotedbl = 420; t.numbersign = 500; t.dollar = 500; t.percent = 833; t.ampersand = 778; t.quoteright = 333; t.parenleft = 333; t.parenright = 333; t.asterisk = 500; t.plus = 675; t.comma = 250; t.hyphen = 333; t.period = 250; t.slash = 278; t.zero = 500; t.one = 500; t.two = 500; t.three = 500; t.four = 500; t.five = 500; t.six = 500; t.seven = 500; t.eight = 500; t.nine = 500; t.colon = 333; t.semicolon = 333; t.less = 675; t.equal = 675; t.greater = 675; t.question = 500; t.at = 920; t.A = 611; t.B = 611; t.C = 667; t.D = 722; t.E = 611; t.F = 611; t.G = 722; t.H = 722; t.I = 333; t.J = 444; t.K = 667; t.L = 556; t.M = 833; t.N = 667; t.O = 722; t.P = 611; t.Q = 722; t.R = 611; t.S = 500; t.T = 556; t.U = 722; t.V = 611; t.W = 833; t.X = 611; t.Y = 556; t.Z = 556; t.bracketleft = 389; t.backslash = 278; t.bracketright = 389; t.asciicircum = 422; t.underscore = 500; t.quoteleft = 333; t.a = 500; t.b = 500; t.c = 444; t.d = 500; t.e = 444; t.f = 278; t.g = 500; t.h = 500; t.i = 278; t.j = 278; t.k = 444; t.l = 278; t.m = 722; t.n = 500; t.o = 500; t.p = 500; t.q = 500; t.r = 389; t.s = 389; t.t = 278; t.u = 500; t.v = 444; t.w = 667; t.x = 444; t.y = 444; t.z = 389; t.braceleft = 400; t.bar = 275; t.braceright = 400; t.asciitilde = 541; t.exclamdown = 389; t.cent = 500; t.sterling = 500; t.fraction = 167; t.yen = 500; t.florin = 500; t.section = 500; t.currency = 500; t.quotesingle = 214; t.quotedblleft = 556; t.guillemotleft = 500; t.guilsinglleft = 333; t.guilsinglright = 333; t.fi = 500; t.fl = 500; t.endash = 500; t.dagger = 500; t.daggerdbl = 500; t.periodcentered = 250; t.paragraph = 523; t.bullet = 350; t.quotesinglbase = 333; t.quotedblbase = 556; t.quotedblright = 556; t.guillemotright = 500; t.ellipsis = 889; t.perthousand = 1000; t.questiondown = 500; t.grave = 333; t.acute = 333; t.circumflex = 333; t.tilde = 333; t.macron = 333; t.breve = 333; t.dotaccent = 333; t.dieresis = 333; t.ring = 333; t.cedilla = 333; t.hungarumlaut = 333; t.ogonek = 333; t.caron = 333; t.emdash = 889; t.AE = 889; t.ordfeminine = 276; t.Lslash = 556; t.Oslash = 722; t.OE = 944; t.ordmasculine = 310; t.ae = 667; t.dotlessi = 278; t.lslash = 278; t.oslash = 500; t.oe = 667; t.germandbls = 500; t.Idieresis = 333; t.eacute = 444; t.abreve = 500; t.uhungarumlaut = 500; t.ecaron = 444; t.Ydieresis = 556; t.divide = 675; t.Yacute = 556; t.Acircumflex = 611; t.aacute = 500; t.Ucircumflex = 722; t.yacute = 444; t.scommaaccent = 389; t.ecircumflex = 444; t.Uring = 722; t.Udieresis = 722; t.aogonek = 500; t.Uacute = 722; t.uogonek = 500; t.Edieresis = 611; t.Dcroat = 722; t.commaaccent = 250; t.copyright = 760; t.Emacron = 611; t.ccaron = 444; t.aring = 500; t.Ncommaaccent = 667; t.lacute = 278; t.agrave = 500; t.Tcommaaccent = 556; t.Cacute = 667; t.atilde = 500; t.Edotaccent = 611; t.scaron = 389; t.scedilla = 389; t.iacute = 278; t.lozenge = 471; t.Rcaron = 611; t.Gcommaaccent = 722; t.ucircumflex = 500; t.acircumflex = 500; t.Amacron = 611; t.rcaron = 389; t.ccedilla = 444; t.Zdotaccent = 556; t.Thorn = 611; t.Omacron = 722; t.Racute = 611; t.Sacute = 500; t.dcaron = 544; t.Umacron = 722; t.uring = 500; t.threesuperior = 300; t.Ograve = 722; t.Agrave = 611; t.Abreve = 611; t.multiply = 675; t.uacute = 500; t.Tcaron = 556; t.partialdiff = 476; t.ydieresis = 444; t.Nacute = 667; t.icircumflex = 278; t.Ecircumflex = 611; t.adieresis = 500; t.edieresis = 444; t.cacute = 444; t.nacute = 500; t.umacron = 500; t.Ncaron = 667; t.Iacute = 333; t.plusminus = 675; t.brokenbar = 275; t.registered = 760; t.Gbreve = 722; t.Idotaccent = 333; t.summation = 600; t.Egrave = 611; t.racute = 389; t.omacron = 500; t.Zacute = 556; t.Zcaron = 556; t.greaterequal = 549; t.Eth = 722; t.Ccedilla = 667; t.lcommaaccent = 278; t.tcaron = 300; t.eogonek = 444; t.Uogonek = 722; t.Aacute = 611; t.Adieresis = 611; t.egrave = 444; t.zacute = 389; t.iogonek = 278; t.Oacute = 722; t.oacute = 500; t.amacron = 500; t.sacute = 389; t.idieresis = 278; t.Ocircumflex = 722; t.Ugrave = 722; t.Delta = 612; t.thorn = 500; t.twosuperior = 300; t.Odieresis = 722; t.mu = 500; t.igrave = 278; t.ohungarumlaut = 500; t.Eogonek = 611; t.dcroat = 500; t.threequarters = 750; t.Scedilla = 500; t.lcaron = 300; t.Kcommaaccent = 667; t.Lacute = 556; t.trademark = 980; t.edotaccent = 444; t.Igrave = 333; t.Imacron = 333; t.Lcaron = 611; t.onehalf = 750; t.lessequal = 549; t.ocircumflex = 500; t.ntilde = 500; t.Uhungarumlaut = 722; t.Eacute = 611; t.emacron = 444; t.gbreve = 500; t.onequarter = 750; t.Scaron = 500; t.Scommaaccent = 500; t.Ohungarumlaut = 722; t.degree = 400; t.ograve = 500; t.Ccaron = 667; t.ugrave = 500; t.radical = 453; t.Dcaron = 722; t.rcommaaccent = 389; t.Ntilde = 667; t.otilde = 500; t.Rcommaaccent = 611; t.Lcommaaccent = 556; t.Atilde = 611; t.Aogonek = 611; t.Aring = 611; t.Otilde = 722; t.zdotaccent = 389; t.Ecaron = 611; t.Iogonek = 333; t.kcommaaccent = 444; t.minus = 675; t.Icircumflex = 333; t.ncaron = 500; t.tcommaaccent = 278; t.logicalnot = 675; t.odieresis = 500; t.udieresis = 500; t.notequal = 549; t.gcommaaccent = 500; t.eth = 500; t.zcaron = 389; t.ncommaaccent = 500; t.onesuperior = 300; t.imacron = 278; t.Euro = 500; }); t.ZapfDingbats = getLookupTableFactory(function (t) { t.space = 278; t.a1 = 974; t.a2 = 961; t.a202 = 974; t.a3 = 980; t.a4 = 719; t.a5 = 789; t.a119 = 790; t.a118 = 791; t.a117 = 690; t.a11 = 960; t.a12 = 939; t.a13 = 549; t.a14 = 855; t.a15 = 911; t.a16 = 933; t.a105 = 911; t.a17 = 945; t.a18 = 974; t.a19 = 755; t.a20 = 846; t.a21 = 762; t.a22 = 761; t.a23 = 571; t.a24 = 677; t.a25 = 763; t.a26 = 760; t.a27 = 759; t.a28 = 754; t.a6 = 494; t.a7 = 552; t.a8 = 537; t.a9 = 577; t.a10 = 692; t.a29 = 786; t.a30 = 788; t.a31 = 788; t.a32 = 790; t.a33 = 793; t.a34 = 794; t.a35 = 816; t.a36 = 823; t.a37 = 789; t.a38 = 841; t.a39 = 823; t.a40 = 833; t.a41 = 816; t.a42 = 831; t.a43 = 923; t.a44 = 744; t.a45 = 723; t.a46 = 749; t.a47 = 790; t.a48 = 792; t.a49 = 695; t.a50 = 776; t.a51 = 768; t.a52 = 792; t.a53 = 759; t.a54 = 707; t.a55 = 708; t.a56 = 682; t.a57 = 701; t.a58 = 826; t.a59 = 815; t.a60 = 789; t.a61 = 789; t.a62 = 707; t.a63 = 687; t.a64 = 696; t.a65 = 689; t.a66 = 786; t.a67 = 787; t.a68 = 713; t.a69 = 791; t.a70 = 785; t.a71 = 791; t.a72 = 873; t.a73 = 761; t.a74 = 762; t.a203 = 762; t.a75 = 759; t.a204 = 759; t.a76 = 892; t.a77 = 892; t.a78 = 788; t.a79 = 784; t.a81 = 438; t.a82 = 138; t.a83 = 277; t.a84 = 415; t.a97 = 392; t.a98 = 392; t.a99 = 668; t.a100 = 668; t.a89 = 390; t.a90 = 390; t.a93 = 317; t.a94 = 317; t.a91 = 276; t.a92 = 276; t.a205 = 509; t.a85 = 509; t.a206 = 410; t.a86 = 410; t.a87 = 234; t.a88 = 234; t.a95 = 334; t.a96 = 334; t.a101 = 732; t.a102 = 544; t.a103 = 544; t.a104 = 910; t.a106 = 667; t.a107 = 760; t.a108 = 760; t.a112 = 776; t.a111 = 595; t.a110 = 694; t.a109 = 626; t.a120 = 788; t.a121 = 788; t.a122 = 788; t.a123 = 788; t.a124 = 788; t.a125 = 788; t.a126 = 788; t.a127 = 788; t.a128 = 788; t.a129 = 788; t.a130 = 788; t.a131 = 788; t.a132 = 788; t.a133 = 788; t.a134 = 788; t.a135 = 788; t.a136 = 788; t.a137 = 788; t.a138 = 788; t.a139 = 788; t.a140 = 788; t.a141 = 788; t.a142 = 788; t.a143 = 788; t.a144 = 788; t.a145 = 788; t.a146 = 788; t.a147 = 788; t.a148 = 788; t.a149 = 788; t.a150 = 788; t.a151 = 788; t.a152 = 788; t.a153 = 788; t.a154 = 788; t.a155 = 788; t.a156 = 788; t.a157 = 788; t.a158 = 788; t.a159 = 788; t.a160 = 894; t.a161 = 838; t.a163 = 1016; t.a164 = 458; t.a196 = 748; t.a165 = 924; t.a192 = 748; t.a166 = 918; t.a167 = 927; t.a168 = 928; t.a169 = 928; t.a170 = 834; t.a171 = 873; t.a172 = 828; t.a173 = 924; t.a162 = 924; t.a174 = 917; t.a175 = 930; t.a176 = 931; t.a177 = 463; t.a178 = 883; t.a179 = 836; t.a193 = 836; t.a180 = 867; t.a199 = 867; t.a181 = 696; t.a200 = 696; t.a182 = 874; t.a201 = 874; t.a183 = 760; t.a184 = 946; t.a197 = 771; t.a185 = 865; t.a194 = 771; t.a198 = 888; t.a186 = 967; t.a195 = 888; t.a187 = 831; t.a188 = 873; t.a189 = 927; t.a190 = 970; t.a191 = 918; }); }); const getFontBasicMetrics = getLookupTableFactory(function (t) { t.Courier = { ascent: 629, descent: -157, capHeight: 562, xHeight: -426 }; t["Courier-Bold"] = { ascent: 629, descent: -157, capHeight: 562, xHeight: 439 }; t["Courier-Oblique"] = { ascent: 629, descent: -157, capHeight: 562, xHeight: 426 }; t["Courier-BoldOblique"] = { ascent: 629, descent: -157, capHeight: 562, xHeight: 426 }; t.Helvetica = { ascent: 718, descent: -207, capHeight: 718, xHeight: 523 }; t["Helvetica-Bold"] = { ascent: 718, descent: -207, capHeight: 718, xHeight: 532 }; t["Helvetica-Oblique"] = { ascent: 718, descent: -207, capHeight: 718, xHeight: 523 }; t["Helvetica-BoldOblique"] = { ascent: 718, descent: -207, capHeight: 718, xHeight: 532 }; t["Times-Roman"] = { ascent: 683, descent: -217, capHeight: 662, xHeight: 450 }; t["Times-Bold"] = { ascent: 683, descent: -217, capHeight: 676, xHeight: 461 }; t["Times-Italic"] = { ascent: 683, descent: -217, capHeight: 653, xHeight: 441 }; t["Times-BoldItalic"] = { ascent: 683, descent: -217, capHeight: 669, xHeight: 462 }; t.Symbol = { ascent: Math.NaN, descent: Math.NaN, capHeight: Math.NaN, xHeight: Math.NaN }; t.ZapfDingbats = { ascent: Math.NaN, descent: Math.NaN, capHeight: Math.NaN, xHeight: Math.NaN }; }); ;// CONCATENATED MODULE: ./src/core/glyf.js const ON_CURVE_POINT = 1 << 0; const X_SHORT_VECTOR = 1 << 1; const Y_SHORT_VECTOR = 1 << 2; const REPEAT_FLAG = 1 << 3; const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4; const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5; const OVERLAP_SIMPLE = 1 << 6; const ARG_1_AND_2_ARE_WORDS = 1 << 0; const ARGS_ARE_XY_VALUES = 1 << 1; const WE_HAVE_A_SCALE = 1 << 3; const MORE_COMPONENTS = 1 << 5; const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6; const WE_HAVE_A_TWO_BY_TWO = 1 << 7; const WE_HAVE_INSTRUCTIONS = 1 << 8; class GlyfTable { constructor({ glyfTable, isGlyphLocationsLong, locaTable, numGlyphs }) { this.glyphs = []; const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength); const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength); const offsetSize = isGlyphLocationsLong ? 4 : 2; let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0); let pos = 0; for (let i = 0; i < numGlyphs; i++) { pos += offsetSize; const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos); if (next === prev) { this.glyphs.push(new Glyph({})); continue; } const glyph = Glyph.parse(prev, glyf); this.glyphs.push(glyph); prev = next; } } getSize() { return this.glyphs.reduce((a, g) => { const size = g.getSize(); return a + (size + 3 & ~3); }, 0); } write() { const totalSize = this.getSize(); const glyfTable = new DataView(new ArrayBuffer(totalSize)); const isLocationLong = totalSize > 0x1fffe; const offsetSize = isLocationLong ? 4 : 2; const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize)); if (isLocationLong) { locaTable.setUint32(0, 0); } else { locaTable.setUint16(0, 0); } let pos = 0; let locaIndex = 0; for (const glyph of this.glyphs) { pos += glyph.write(pos, glyfTable); pos = pos + 3 & ~3; locaIndex += offsetSize; if (isLocationLong) { locaTable.setUint32(locaIndex, pos); } else { locaTable.setUint16(locaIndex, pos >> 1); } } return { isLocationLong, loca: new Uint8Array(locaTable.buffer), glyf: new Uint8Array(glyfTable.buffer) }; } scale(factors) { for (let i = 0, ii = this.glyphs.length; i < ii; i++) { this.glyphs[i].scale(factors[i]); } } } class Glyph { constructor({ header = null, simple = null, composites = null }) { this.header = header; this.simple = simple; this.composites = composites; } static parse(pos, glyf) { const [read, header] = GlyphHeader.parse(pos, glyf); pos += read; if (header.numberOfContours < 0) { const composites = []; while (true) { const [n, composite] = CompositeGlyph.parse(pos, glyf); pos += n; composites.push(composite); if (!(composite.flags & MORE_COMPONENTS)) { break; } } return new Glyph({ header, composites }); } const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours); return new Glyph({ header, simple }); } getSize() { if (!this.header) { return 0; } const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0); return this.header.getSize() + size; } write(pos, buf) { if (!this.header) { return 0; } const spos = pos; pos += this.header.write(pos, buf); if (this.simple) { pos += this.simple.write(pos, buf); } else { for (const composite of this.composites) { pos += composite.write(pos, buf); } } return pos - spos; } scale(factor) { if (!this.header) { return; } const xMiddle = (this.header.xMin + this.header.xMax) / 2; this.header.scale(xMiddle, factor); if (this.simple) { this.simple.scale(xMiddle, factor); } else { for (const composite of this.composites) { composite.scale(xMiddle, factor); } } } } class GlyphHeader { constructor({ numberOfContours, xMin, yMin, xMax, yMax }) { this.numberOfContours = numberOfContours; this.xMin = xMin; this.yMin = yMin; this.xMax = xMax; this.yMax = yMax; } static parse(pos, glyf) { return [10, new GlyphHeader({ numberOfContours: glyf.getInt16(pos), xMin: glyf.getInt16(pos + 2), yMin: glyf.getInt16(pos + 4), xMax: glyf.getInt16(pos + 6), yMax: glyf.getInt16(pos + 8) })]; } getSize() { return 10; } write(pos, buf) { buf.setInt16(pos, this.numberOfContours); buf.setInt16(pos + 2, this.xMin); buf.setInt16(pos + 4, this.yMin); buf.setInt16(pos + 6, this.xMax); buf.setInt16(pos + 8, this.yMax); return 10; } scale(x, factor) { this.xMin = Math.round(x + (this.xMin - x) * factor); this.xMax = Math.round(x + (this.xMax - x) * factor); } } class Contour { constructor({ flags, xCoordinates, yCoordinates }) { this.xCoordinates = xCoordinates; this.yCoordinates = yCoordinates; this.flags = flags; } } class SimpleGlyph { constructor({ contours, instructions }) { this.contours = contours; this.instructions = instructions; } static parse(pos, glyf, numberOfContours) { const endPtsOfContours = []; for (let i = 0; i < numberOfContours; i++) { const endPt = glyf.getUint16(pos); pos += 2; endPtsOfContours.push(endPt); } const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1; const instructionLength = glyf.getUint16(pos); pos += 2; const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength); pos += instructionLength; const flags = []; for (let i = 0; i < numberOfPt; pos++, i++) { let flag = glyf.getUint8(pos); flags.push(flag); if (flag & REPEAT_FLAG) { const count = glyf.getUint8(++pos); flag ^= REPEAT_FLAG; for (let m = 0; m < count; m++) { flags.push(flag); } i += count; } } const allXCoordinates = []; let xCoordinates = []; let yCoordinates = []; let pointFlags = []; const contours = []; let endPtsOfContoursIndex = 0; let lastCoordinate = 0; for (let i = 0; i < numberOfPt; i++) { const flag = flags[i]; if (flag & X_SHORT_VECTOR) { const x = glyf.getUint8(pos++); lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x; xCoordinates.push(lastCoordinate); } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) { xCoordinates.push(lastCoordinate); } else { lastCoordinate += glyf.getInt16(pos); pos += 2; xCoordinates.push(lastCoordinate); } if (endPtsOfContours[endPtsOfContoursIndex] === i) { endPtsOfContoursIndex++; allXCoordinates.push(xCoordinates); xCoordinates = []; } } lastCoordinate = 0; endPtsOfContoursIndex = 0; for (let i = 0; i < numberOfPt; i++) { const flag = flags[i]; if (flag & Y_SHORT_VECTOR) { const y = glyf.getUint8(pos++); lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y; yCoordinates.push(lastCoordinate); } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) { yCoordinates.push(lastCoordinate); } else { lastCoordinate += glyf.getInt16(pos); pos += 2; yCoordinates.push(lastCoordinate); } pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE); if (endPtsOfContours[endPtsOfContoursIndex] === i) { xCoordinates = allXCoordinates[endPtsOfContoursIndex]; endPtsOfContoursIndex++; contours.push(new Contour({ flags: pointFlags, xCoordinates, yCoordinates })); yCoordinates = []; pointFlags = []; } } return new SimpleGlyph({ contours, instructions }); } getSize() { let size = this.contours.length * 2 + 2 + this.instructions.length; let lastX = 0; let lastY = 0; for (const contour of this.contours) { size += contour.flags.length; for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { const x = contour.xCoordinates[i]; const y = contour.yCoordinates[i]; let abs = Math.abs(x - lastX); if (abs > 255) { size += 2; } else if (abs > 0) { size += 1; } lastX = x; abs = Math.abs(y - lastY); if (abs > 255) { size += 2; } else if (abs > 0) { size += 1; } lastY = y; } } return size; } write(pos, buf) { const spos = pos; const xCoordinates = []; const yCoordinates = []; const flags = []; let lastX = 0; let lastY = 0; for (const contour of this.contours) { for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { let flag = contour.flags[i]; const x = contour.xCoordinates[i]; let delta = x - lastX; if (delta === 0) { flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR; xCoordinates.push(0); } else { const abs = Math.abs(delta); if (abs <= 255) { flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR; xCoordinates.push(abs); } else { xCoordinates.push(delta); } } lastX = x; const y = contour.yCoordinates[i]; delta = y - lastY; if (delta === 0) { flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR; yCoordinates.push(0); } else { const abs = Math.abs(delta); if (abs <= 255) { flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR; yCoordinates.push(abs); } else { yCoordinates.push(delta); } } lastY = y; flags.push(flag); } buf.setUint16(pos, xCoordinates.length - 1); pos += 2; } buf.setUint16(pos, this.instructions.length); pos += 2; if (this.instructions.length) { new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos); pos += this.instructions.length; } for (const flag of flags) { buf.setUint8(pos++, flag); } for (let i = 0, ii = xCoordinates.length; i < ii; i++) { const x = xCoordinates[i]; const flag = flags[i]; if (flag & X_SHORT_VECTOR) { buf.setUint8(pos++, x); } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) { buf.setInt16(pos, x); pos += 2; } } for (let i = 0, ii = yCoordinates.length; i < ii; i++) { const y = yCoordinates[i]; const flag = flags[i]; if (flag & Y_SHORT_VECTOR) { buf.setUint8(pos++, y); } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) { buf.setInt16(pos, y); pos += 2; } } return pos - spos; } scale(x, factor) { for (const contour of this.contours) { if (contour.xCoordinates.length === 0) { continue; } for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor); } } } } class CompositeGlyph { constructor({ flags, glyphIndex, argument1, argument2, transf, instructions }) { this.flags = flags; this.glyphIndex = glyphIndex; this.argument1 = argument1; this.argument2 = argument2; this.transf = transf; this.instructions = instructions; } static parse(pos, glyf) { const spos = pos; const transf = []; let flags = glyf.getUint16(pos); const glyphIndex = glyf.getUint16(pos + 2); pos += 4; let argument1, argument2; if (flags & ARG_1_AND_2_ARE_WORDS) { if (flags & ARGS_ARE_XY_VALUES) { argument1 = glyf.getInt16(pos); argument2 = glyf.getInt16(pos + 2); } else { argument1 = glyf.getUint16(pos); argument2 = glyf.getUint16(pos + 2); } pos += 4; flags ^= ARG_1_AND_2_ARE_WORDS; } else { if (flags & ARGS_ARE_XY_VALUES) { argument1 = glyf.getInt8(pos); argument2 = glyf.getInt8(pos + 1); } else { argument1 = glyf.getUint8(pos); argument2 = glyf.getUint8(pos + 1); } pos += 2; } if (flags & WE_HAVE_A_SCALE) { transf.push(glyf.getUint16(pos)); pos += 2; } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) { transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2)); pos += 4; } else if (flags & WE_HAVE_A_TWO_BY_TWO) { transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6)); pos += 8; } let instructions = null; if (flags & WE_HAVE_INSTRUCTIONS) { const instructionLength = glyf.getUint16(pos); pos += 2; instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength); pos += instructionLength; } return [pos - spos, new CompositeGlyph({ flags, glyphIndex, argument1, argument2, transf, instructions })]; } getSize() { let size = 2 + 2 + this.transf.length * 2; if (this.flags & WE_HAVE_INSTRUCTIONS) { size += 2 + this.instructions.length; } size += 2; if (this.flags & 2) { if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) { size += 2; } } else if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) { size += 2; } return size; } write(pos, buf) { const spos = pos; if (this.flags & ARGS_ARE_XY_VALUES) { if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) { this.flags |= ARG_1_AND_2_ARE_WORDS; } } else if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) { this.flags |= ARG_1_AND_2_ARE_WORDS; } buf.setUint16(pos, this.flags); buf.setUint16(pos + 2, this.glyphIndex); pos += 4; if (this.flags & ARG_1_AND_2_ARE_WORDS) { if (this.flags & ARGS_ARE_XY_VALUES) { buf.setInt16(pos, this.argument1); buf.setInt16(pos + 2, this.argument2); } else { buf.setUint16(pos, this.argument1); buf.setUint16(pos + 2, this.argument2); } pos += 4; } else { buf.setUint8(pos, this.argument1); buf.setUint8(pos + 1, this.argument2); pos += 2; } if (this.flags & WE_HAVE_INSTRUCTIONS) { buf.setUint16(pos, this.instructions.length); pos += 2; if (this.instructions.length) { new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos); pos += this.instructions.length; } } return pos - spos; } scale(x, factor) {} } ;// CONCATENATED MODULE: ./src/core/opentype_file_builder.js function writeInt16(dest, offset, num) { dest[offset] = num >> 8 & 0xff; dest[offset + 1] = num & 0xff; } function writeInt32(dest, offset, num) { dest[offset] = num >> 24 & 0xff; dest[offset + 1] = num >> 16 & 0xff; dest[offset + 2] = num >> 8 & 0xff; dest[offset + 3] = num & 0xff; } function writeData(dest, offset, data) { if (data instanceof Uint8Array) { dest.set(data, offset); } else if (typeof data === "string") { for (let i = 0, ii = data.length; i < ii; i++) { dest[offset++] = data.charCodeAt(i) & 0xff; } } else { for (const num of data) { dest[offset++] = num & 0xff; } } } const OTF_HEADER_SIZE = 12; const OTF_TABLE_ENTRY_SIZE = 16; class OpenTypeFileBuilder { constructor(sfnt) { this.sfnt = sfnt; this.tables = Object.create(null); } static getSearchParams(entriesCount, entrySize) { let maxPower2 = 1, log2 = 0; while ((maxPower2 ^ entriesCount) > maxPower2) { maxPower2 <<= 1; log2++; } const searchRange = maxPower2 * entrySize; return { range: searchRange, entry: log2, rangeShift: entrySize * entriesCount - searchRange }; } toArray() { let sfnt = this.sfnt; const tables = this.tables; const tablesNames = Object.keys(tables); tablesNames.sort(); const numTables = tablesNames.length; let i, j, jj, table, tableName; let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE; const tableOffsets = [offset]; for (i = 0; i < numTables; i++) { table = tables[tablesNames[i]]; const paddedLength = (table.length + 3 & ~3) >>> 0; offset += paddedLength; tableOffsets.push(offset); } const file = new Uint8Array(offset); for (i = 0; i < numTables; i++) { table = tables[tablesNames[i]]; writeData(file, tableOffsets[i], table); } if (sfnt === "true") { sfnt = string32(0x00010000); } file[0] = sfnt.charCodeAt(0) & 0xff; file[1] = sfnt.charCodeAt(1) & 0xff; file[2] = sfnt.charCodeAt(2) & 0xff; file[3] = sfnt.charCodeAt(3) & 0xff; writeInt16(file, 4, numTables); const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16); writeInt16(file, 6, searchParams.range); writeInt16(file, 8, searchParams.entry); writeInt16(file, 10, searchParams.rangeShift); offset = OTF_HEADER_SIZE; for (i = 0; i < numTables; i++) { tableName = tablesNames[i]; file[offset] = tableName.charCodeAt(0) & 0xff; file[offset + 1] = tableName.charCodeAt(1) & 0xff; file[offset + 2] = tableName.charCodeAt(2) & 0xff; file[offset + 3] = tableName.charCodeAt(3) & 0xff; let checksum = 0; for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) { const quad = readUint32(file, j); checksum = checksum + quad >>> 0; } writeInt32(file, offset + 4, checksum); writeInt32(file, offset + 8, tableOffsets[i]); writeInt32(file, offset + 12, tables[tableName].length); offset += OTF_TABLE_ENTRY_SIZE; } return file; } addTable(tag, data) { if (tag in this.tables) { throw new Error("Table " + tag + " already exists"); } this.tables[tag] = data; } } ;// CONCATENATED MODULE: ./src/core/type1_parser.js const HINTING_ENABLED = false; const COMMAND_MAP = { hstem: [1], vstem: [3], vmoveto: [4], rlineto: [5], hlineto: [6], vlineto: [7], rrcurveto: [8], callsubr: [10], flex: [12, 35], drop: [12, 18], endchar: [14], rmoveto: [21], hmoveto: [22], vhcurveto: [30], hvcurveto: [31] }; class Type1CharString { constructor() { this.width = 0; this.lsb = 0; this.flexing = false; this.output = []; this.stack = []; } convert(encoded, subrs, seacAnalysisEnabled) { const count = encoded.length; let error = false; let wx, sbx, subrNumber; for (let i = 0; i < count; i++) { let value = encoded[i]; if (value < 32) { if (value === 12) { value = (value << 8) + encoded[++i]; } switch (value) { case 1: if (!HINTING_ENABLED) { this.stack = []; break; } error = this.executeCommand(2, COMMAND_MAP.hstem); break; case 3: if (!HINTING_ENABLED) { this.stack = []; break; } error = this.executeCommand(2, COMMAND_MAP.vstem); break; case 4: if (this.flexing) { if (this.stack.length < 1) { error = true; break; } const dy = this.stack.pop(); this.stack.push(0, dy); break; } error = this.executeCommand(1, COMMAND_MAP.vmoveto); break; case 5: error = this.executeCommand(2, COMMAND_MAP.rlineto); break; case 6: error = this.executeCommand(1, COMMAND_MAP.hlineto); break; case 7: error = this.executeCommand(1, COMMAND_MAP.vlineto); break; case 8: error = this.executeCommand(6, COMMAND_MAP.rrcurveto); break; case 9: this.stack = []; break; case 10: if (this.stack.length < 1) { error = true; break; } subrNumber = this.stack.pop(); if (!subrs[subrNumber]) { error = true; break; } error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled); break; case 11: return error; case 13: if (this.stack.length < 2) { error = true; break; } wx = this.stack.pop(); sbx = this.stack.pop(); this.lsb = sbx; this.width = wx; this.stack.push(wx, sbx); error = this.executeCommand(2, COMMAND_MAP.hmoveto); break; case 14: this.output.push(COMMAND_MAP.endchar[0]); break; case 21: if (this.flexing) { break; } error = this.executeCommand(2, COMMAND_MAP.rmoveto); break; case 22: if (this.flexing) { this.stack.push(0); break; } error = this.executeCommand(1, COMMAND_MAP.hmoveto); break; case 30: error = this.executeCommand(4, COMMAND_MAP.vhcurveto); break; case 31: error = this.executeCommand(4, COMMAND_MAP.hvcurveto); break; case (12 << 8) + 0: this.stack = []; break; case (12 << 8) + 1: if (!HINTING_ENABLED) { this.stack = []; break; } error = this.executeCommand(2, COMMAND_MAP.vstem); break; case (12 << 8) + 2: if (!HINTING_ENABLED) { this.stack = []; break; } error = this.executeCommand(2, COMMAND_MAP.hstem); break; case (12 << 8) + 6: if (seacAnalysisEnabled) { const asb = this.stack.at(-5); this.seac = this.stack.splice(-4, 4); this.seac[0] += this.lsb - asb; error = this.executeCommand(0, COMMAND_MAP.endchar); } else { error = this.executeCommand(4, COMMAND_MAP.endchar); } break; case (12 << 8) + 7: if (this.stack.length < 4) { error = true; break; } this.stack.pop(); wx = this.stack.pop(); const sby = this.stack.pop(); sbx = this.stack.pop(); this.lsb = sbx; this.width = wx; this.stack.push(wx, sbx, sby); error = this.executeCommand(3, COMMAND_MAP.rmoveto); break; case (12 << 8) + 12: if (this.stack.length < 2) { error = true; break; } const num2 = this.stack.pop(); const num1 = this.stack.pop(); this.stack.push(num1 / num2); break; case (12 << 8) + 16: if (this.stack.length < 2) { error = true; break; } subrNumber = this.stack.pop(); const numArgs = this.stack.pop(); if (subrNumber === 0 && numArgs === 3) { const flexArgs = this.stack.splice(-17, 17); this.stack.push(flexArgs[2] + flexArgs[0], flexArgs[3] + flexArgs[1], flexArgs[4], flexArgs[5], flexArgs[6], flexArgs[7], flexArgs[8], flexArgs[9], flexArgs[10], flexArgs[11], flexArgs[12], flexArgs[13], flexArgs[14]); error = this.executeCommand(13, COMMAND_MAP.flex, true); this.flexing = false; this.stack.push(flexArgs[15], flexArgs[16]); } else if (subrNumber === 1 && numArgs === 0) { this.flexing = true; } break; case (12 << 8) + 17: break; case (12 << 8) + 33: this.stack = []; break; default: warn('Unknown type 1 charstring command of "' + value + '"'); break; } if (error) { break; } continue; } else if (value <= 246) { value -= 139; } else if (value <= 250) { value = (value - 247) * 256 + encoded[++i] + 108; } else if (value <= 254) { value = -((value - 251) * 256) - encoded[++i] - 108; } else { value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0; } this.stack.push(value); } return error; } executeCommand(howManyArgs, command, keepStack) { const stackLength = this.stack.length; if (howManyArgs > stackLength) { return true; } const start = stackLength - howManyArgs; for (let i = start; i < stackLength; i++) { let value = this.stack[i]; if (Number.isInteger(value)) { this.output.push(28, value >> 8 & 0xff, value & 0xff); } else { value = 65536 * value | 0; this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); } } this.output.push(...command); if (keepStack) { this.stack.splice(start, howManyArgs); } else { this.stack.length = 0; } return false; } } const EEXEC_ENCRYPT_KEY = 55665; const CHAR_STRS_ENCRYPT_KEY = 4330; function isHexDigit(code) { return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102; } function decrypt(data, key, discardNumber) { if (discardNumber >= data.length) { return new Uint8Array(0); } const c1 = 52845, c2 = 22719; let r = key | 0, i, j; for (i = 0; i < discardNumber; i++) { r = (data[i] + r) * c1 + c2 & (1 << 16) - 1; } const count = data.length - discardNumber; const decrypted = new Uint8Array(count); for (i = discardNumber, j = 0; j < count; i++, j++) { const value = data[i]; decrypted[j] = value ^ r >> 8; r = (value + r) * c1 + c2 & (1 << 16) - 1; } return decrypted; } function decryptAscii(data, key, discardNumber) { const c1 = 52845, c2 = 22719; let r = key | 0; const count = data.length, maybeLength = count >>> 1; const decrypted = new Uint8Array(maybeLength); let i, j; for (i = 0, j = 0; i < count; i++) { const digit1 = data[i]; if (!isHexDigit(digit1)) { continue; } i++; let digit2; while (i < count && !isHexDigit(digit2 = data[i])) { i++; } if (i < count) { const value = parseInt(String.fromCharCode(digit1, digit2), 16); decrypted[j++] = value ^ r >> 8; r = (value + r) * c1 + c2 & (1 << 16) - 1; } } return decrypted.slice(discardNumber, j); } function isSpecial(c) { return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29; } class Type1Parser { constructor(stream, encrypted, seacAnalysisEnabled) { if (encrypted) { const data = stream.getBytes(); const isBinary = !((isHexDigit(data[0]) || isWhiteSpace(data[0])) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]) && isHexDigit(data[4]) && isHexDigit(data[5]) && isHexDigit(data[6]) && isHexDigit(data[7])); stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4)); } this.seacAnalysisEnabled = !!seacAnalysisEnabled; this.stream = stream; this.nextChar(); } readNumberArray() { this.getToken(); const array = []; while (true) { const token = this.getToken(); if (token === null || token === "]" || token === "}") { break; } array.push(parseFloat(token || 0)); } return array; } readNumber() { const token = this.getToken(); return parseFloat(token || 0); } readInt() { const token = this.getToken(); return parseInt(token || 0, 10) | 0; } readBoolean() { const token = this.getToken(); return token === "true" ? 1 : 0; } nextChar() { return this.currentChar = this.stream.getByte(); } prevChar() { this.stream.skip(-2); return this.currentChar = this.stream.getByte(); } getToken() { let comment = false; let ch = this.currentChar; while (true) { if (ch === -1) { return null; } if (comment) { if (ch === 0x0a || ch === 0x0d) { comment = false; } } else if (ch === 0x25) { comment = true; } else if (!isWhiteSpace(ch)) { break; } ch = this.nextChar(); } if (isSpecial(ch)) { this.nextChar(); return String.fromCharCode(ch); } let token = ""; do { token += String.fromCharCode(ch); ch = this.nextChar(); } while (ch >= 0 && !isWhiteSpace(ch) && !isSpecial(ch)); return token; } readCharStrings(bytes, lenIV) { if (lenIV === -1) { return bytes; } return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV); } extractFontProgram(properties) { const stream = this.stream; const subrs = [], charstrings = []; const privateData = Object.create(null); privateData.lenIV = 4; const program = { subrs: [], charstrings: [], properties: { privateData } }; let token, length, data, lenIV; while ((token = this.getToken()) !== null) { if (token !== "/") { continue; } token = this.getToken(); switch (token) { case "CharStrings": this.getToken(); this.getToken(); this.getToken(); this.getToken(); while (true) { token = this.getToken(); if (token === null || token === "end") { break; } if (token !== "/") { continue; } const glyph = this.getToken(); length = this.readInt(); this.getToken(); data = length > 0 ? stream.getBytes(length) : new Uint8Array(0); lenIV = program.properties.privateData.lenIV; const encoded = this.readCharStrings(data, lenIV); this.nextChar(); token = this.getToken(); if (token === "noaccess") { this.getToken(); } else if (token === "/") { this.prevChar(); } charstrings.push({ glyph, encoded }); } break; case "Subrs": this.readInt(); this.getToken(); while (this.getToken() === "dup") { const index = this.readInt(); length = this.readInt(); this.getToken(); data = length > 0 ? stream.getBytes(length) : new Uint8Array(0); lenIV = program.properties.privateData.lenIV; const encoded = this.readCharStrings(data, lenIV); this.nextChar(); token = this.getToken(); if (token === "noaccess") { this.getToken(); } subrs[index] = encoded; } break; case "BlueValues": case "OtherBlues": case "FamilyBlues": case "FamilyOtherBlues": const blueArray = this.readNumberArray(); if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) { program.properties.privateData[token] = blueArray; } break; case "StemSnapH": case "StemSnapV": program.properties.privateData[token] = this.readNumberArray(); break; case "StdHW": case "StdVW": program.properties.privateData[token] = this.readNumberArray()[0]; break; case "BlueShift": case "lenIV": case "BlueFuzz": case "BlueScale": case "LanguageGroup": program.properties.privateData[token] = this.readNumber(); break; case "ExpansionFactor": program.properties.privateData[token] = this.readNumber() || 0.06; break; case "ForceBold": program.properties.privateData[token] = this.readBoolean(); break; } } for (const { encoded, glyph } of charstrings) { const charString = new Type1CharString(); const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled); let output = charString.output; if (error) { output = [14]; } const charStringObject = { glyphName: glyph, charstring: output, width: charString.width, lsb: charString.lsb, seac: charString.seac }; if (glyph === ".notdef") { program.charstrings.unshift(charStringObject); } else { program.charstrings.push(charStringObject); } if (properties.builtInEncoding) { const index = properties.builtInEncoding.indexOf(glyph); if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) { properties.widths[index] = charString.width; } } } return program; } extractFontHeader(properties) { let token; while ((token = this.getToken()) !== null) { if (token !== "/") { continue; } token = this.getToken(); switch (token) { case "FontMatrix": const matrix = this.readNumberArray(); properties.fontMatrix = matrix; break; case "Encoding": const encodingArg = this.getToken(); let encoding; if (!/^\d+$/.test(encodingArg)) { encoding = getEncoding(encodingArg); } else { encoding = []; const size = parseInt(encodingArg, 10) | 0; this.getToken(); for (let j = 0; j < size; j++) { token = this.getToken(); while (token !== "dup" && token !== "def") { token = this.getToken(); if (token === null) { return; } } if (token === "def") { break; } const index = this.readInt(); this.getToken(); const glyph = this.getToken(); encoding[index] = glyph; this.getToken(); } } properties.builtInEncoding = encoding; break; case "FontBBox": const fontBBox = this.readNumberArray(); properties.ascent = Math.max(fontBBox[3], fontBBox[1]); properties.descent = Math.min(fontBBox[1], fontBBox[3]); properties.ascentScaled = true; break; } } } } ;// CONCATENATED MODULE: ./src/core/type1_font.js function findBlock(streamBytes, signature, startIndex) { const streamBytesLength = streamBytes.length; const signatureLength = signature.length; const scanLength = streamBytesLength - signatureLength; let i = startIndex, found = false; while (i < scanLength) { let j = 0; while (j < signatureLength && streamBytes[i + j] === signature[j]) { j++; } if (j >= signatureLength) { i += j; while (i < streamBytesLength && isWhiteSpace(streamBytes[i])) { i++; } found = true; break; } i++; } return { found, length: i }; } function getHeaderBlock(stream, suggestedLength) { const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63]; const streamStartPos = stream.pos; let headerBytes, headerBytesLength, block; try { headerBytes = stream.getBytes(suggestedLength); headerBytesLength = headerBytes.length; } catch {} if (headerBytesLength === suggestedLength) { block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length); if (block.found && block.length === suggestedLength) { return { stream: new Stream(headerBytes), length: suggestedLength }; } } warn('Invalid "Length1" property in Type1 font -- trying to recover.'); stream.pos = streamStartPos; const SCAN_BLOCK_LENGTH = 2048; let actualLength; while (true) { const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH); block = findBlock(scanBytes, EEXEC_SIGNATURE, 0); if (block.length === 0) { break; } stream.pos += block.length; if (block.found) { actualLength = stream.pos - streamStartPos; break; } } stream.pos = streamStartPos; if (actualLength) { return { stream: new Stream(stream.getBytes(actualLength)), length: actualLength }; } warn('Unable to recover "Length1" property in Type1 font -- using as is.'); return { stream: new Stream(stream.getBytes(suggestedLength)), length: suggestedLength }; } function getEexecBlock(stream, suggestedLength) { const eexecBytes = stream.getBytes(); if (eexecBytes.length === 0) { throw new FormatError("getEexecBlock - no font program found."); } return { stream: new Stream(eexecBytes), length: eexecBytes.length }; } class Type1Font { constructor(name, file, properties) { const PFB_HEADER_SIZE = 6; let headerBlockLength = properties.length1; let eexecBlockLength = properties.length2; let pfbHeader = file.peekBytes(PFB_HEADER_SIZE); const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01; if (pfbHeaderPresent) { file.skip(PFB_HEADER_SIZE); headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2]; } const headerBlock = getHeaderBlock(file, headerBlockLength); const headerBlockParser = new Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED); headerBlockParser.extractFontHeader(properties); if (pfbHeaderPresent) { pfbHeader = file.getBytes(PFB_HEADER_SIZE); eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2]; } const eexecBlock = getEexecBlock(file, eexecBlockLength); const eexecBlockParser = new Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED); const data = eexecBlockParser.extractFontProgram(properties); for (const key in data.properties) { properties[key] = data.properties[key]; } const charstrings = data.charstrings; const type2Charstrings = this.getType2Charstrings(charstrings); const subrs = this.getType2Subrs(data.subrs); this.charstrings = charstrings; this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties); this.seacs = this.getSeacs(data.charstrings); } get numGlyphs() { return this.charstrings.length + 1; } getCharset() { const charset = [".notdef"]; for (const { glyphName } of this.charstrings) { charset.push(glyphName); } return charset; } getGlyphMapping(properties) { const charstrings = this.charstrings; if (properties.composite) { const charCodeToGlyphId = Object.create(null); for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) { const charCode = properties.cMap.charCodeOf(glyphId); charCodeToGlyphId[charCode] = glyphId + 1; } return charCodeToGlyphId; } const glyphNames = [".notdef"]; let builtInEncoding, glyphId; for (glyphId = 0; glyphId < charstrings.length; glyphId++) { glyphNames.push(charstrings[glyphId].glyphName); } const encoding = properties.builtInEncoding; if (encoding) { builtInEncoding = Object.create(null); for (const charCode in encoding) { glyphId = glyphNames.indexOf(encoding[charCode]); if (glyphId >= 0) { builtInEncoding[charCode] = glyphId; } } } return type1FontGlyphMapping(properties, builtInEncoding, glyphNames); } hasGlyphId(id) { if (id < 0 || id >= this.numGlyphs) { return false; } if (id === 0) { return true; } const glyph = this.charstrings[id - 1]; return glyph.charstring.length > 0; } getSeacs(charstrings) { const seacMap = []; for (let i = 0, ii = charstrings.length; i < ii; i++) { const charstring = charstrings[i]; if (charstring.seac) { seacMap[i + 1] = charstring.seac; } } return seacMap; } getType2Charstrings(type1Charstrings) { const type2Charstrings = []; for (const type1Charstring of type1Charstrings) { type2Charstrings.push(type1Charstring.charstring); } return type2Charstrings; } getType2Subrs(type1Subrs) { let bias = 0; const count = type1Subrs.length; if (count < 1133) { bias = 107; } else if (count < 33769) { bias = 1131; } else { bias = 32768; } const type2Subrs = []; let i; for (i = 0; i < bias; i++) { type2Subrs.push([0x0b]); } for (i = 0; i < count; i++) { type2Subrs.push(type1Subrs[i]); } return type2Subrs; } wrap(name, glyphs, charstrings, subrs, properties) { const cff = new CFF(); cff.header = new CFFHeader(1, 0, 4, 4); cff.names = [name]; const topDict = new CFFTopDict(); topDict.setByName("version", 391); topDict.setByName("Notice", 392); topDict.setByName("FullName", 393); topDict.setByName("FamilyName", 394); topDict.setByName("Weight", 395); topDict.setByName("Encoding", null); topDict.setByName("FontMatrix", properties.fontMatrix); topDict.setByName("FontBBox", properties.bbox); topDict.setByName("charset", null); topDict.setByName("CharStrings", null); topDict.setByName("Private", null); cff.topDict = topDict; const strings = new CFFStrings(); strings.add("Version 0.11"); strings.add("See original notice"); strings.add(name); strings.add(name); strings.add("Medium"); cff.strings = strings; cff.globalSubrIndex = new CFFIndex(); const count = glyphs.length; const charsetArray = [".notdef"]; let i, ii; for (i = 0; i < count; i++) { const glyphName = charstrings[i].glyphName; const index = CFFStandardStrings.indexOf(glyphName); if (index === -1) { strings.add(glyphName); } charsetArray.push(glyphName); } cff.charset = new CFFCharset(false, 0, charsetArray); const charStringsIndex = new CFFIndex(); charStringsIndex.add([0x8b, 0x0e]); for (i = 0; i < count; i++) { charStringsIndex.add(glyphs[i]); } cff.charStrings = charStringsIndex; const privateDict = new CFFPrivateDict(); privateDict.setByName("Subrs", null); const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"]; for (i = 0, ii = fields.length; i < ii; i++) { const field = fields[i]; if (!(field in properties.privateData)) { continue; } const value = properties.privateData[field]; if (Array.isArray(value)) { for (let j = value.length - 1; j > 0; j--) { value[j] -= value[j - 1]; } } privateDict.setByName(field, value); } cff.topDict.privateDict = privateDict; const subrIndex = new CFFIndex(); for (i = 0, ii = subrs.length; i < ii; i++) { subrIndex.add(subrs[i]); } privateDict.subrsIndex = subrIndex; const compiler = new CFFCompiler(cff); return compiler.compile(); } } ;// CONCATENATED MODULE: ./src/core/fonts.js const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]]; const PDF_GLYPH_SPACE_UNITS = 1000; const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "isInvalidPDFjsFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "systemFontInfo", "type", "vertical"]; const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"]; function adjustWidths(properties) { if (!properties.fontMatrix) { return; } if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) { return; } const scale = 0.001 / properties.fontMatrix[0]; const glyphsWidths = properties.widths; for (const glyph in glyphsWidths) { glyphsWidths[glyph] *= scale; } properties.defaultWidth *= scale; } function adjustTrueTypeToUnicode(properties, isSymbolicFont, nameRecords) { if (properties.isInternalFont) { return; } if (properties.hasIncludedToUnicodeMap) { return; } if (properties.hasEncoding) { return; } if (properties.toUnicode instanceof IdentityToUnicodeMap) { return; } if (!isSymbolicFont) { return; } if (nameRecords.length === 0) { return; } if (properties.defaultEncoding === WinAnsiEncoding) { return; } for (const r of nameRecords) { if (!isWinNameRecord(r)) { return; } } const encoding = WinAnsiEncoding; const toUnicode = [], glyphsUnicodeMap = getGlyphsUnicode(); for (const charCode in encoding) { const glyphName = encoding[charCode]; if (glyphName === "") { continue; } const unicode = glyphsUnicodeMap[glyphName]; if (unicode === undefined) { continue; } toUnicode[charCode] = String.fromCharCode(unicode); } if (toUnicode.length > 0) { properties.toUnicode.amend(toUnicode); } } function adjustType1ToUnicode(properties, builtInEncoding) { if (properties.isInternalFont) { return; } if (properties.hasIncludedToUnicodeMap) { return; } if (builtInEncoding === properties.defaultEncoding) { return; } if (properties.toUnicode instanceof IdentityToUnicodeMap) { return; } const toUnicode = [], glyphsUnicodeMap = getGlyphsUnicode(); for (const charCode in builtInEncoding) { if (properties.hasEncoding) { if (properties.baseEncodingName || properties.differences[charCode] !== undefined) { continue; } } const glyphName = builtInEncoding[charCode]; const unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap); if (unicode !== -1) { toUnicode[charCode] = String.fromCharCode(unicode); } } if (toUnicode.length > 0) { properties.toUnicode.amend(toUnicode); } } function amendFallbackToUnicode(properties) { if (!properties.fallbackToUnicode) { return; } if (properties.toUnicode instanceof IdentityToUnicodeMap) { return; } const toUnicode = []; for (const charCode in properties.fallbackToUnicode) { if (properties.toUnicode.has(charCode)) { continue; } toUnicode[charCode] = properties.fallbackToUnicode[charCode]; } if (toUnicode.length > 0) { properties.toUnicode.amend(toUnicode); } } class fonts_Glyph { constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { this.originalCharCode = originalCharCode; this.fontChar = fontChar; this.unicode = unicode; this.accent = accent; this.width = width; this.vmetric = vmetric; this.operatorListId = operatorListId; this.isSpace = isSpace; this.isInFont = isInFont; } get category() { return shadow(this, "category", getCharUnicodeCategory(this.unicode), true); } } function int16(b0, b1) { return (b0 << 8) + b1; } function writeSignedInt16(bytes, index, value) { bytes[index + 1] = value; bytes[index] = value >>> 8; } function signedInt16(b0, b1) { const value = (b0 << 8) + b1; return value & 1 << 15 ? value - 0x10000 : value; } function writeUint32(bytes, index, value) { bytes[index + 3] = value & 0xff; bytes[index + 2] = value >>> 8; bytes[index + 1] = value >>> 16; bytes[index] = value >>> 24; } function int32(b0, b1, b2, b3) { return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; } function string16(value) { return String.fromCharCode(value >> 8 & 0xff, value & 0xff); } function safeString16(value) { if (value > 0x7fff) { value = 0x7fff; } else if (value < -0x8000) { value = -0x8000; } return String.fromCharCode(value >> 8 & 0xff, value & 0xff); } function isTrueTypeFile(file) { const header = file.peekBytes(4); return readUint32(header, 0) === 0x00010000 || bytesToString(header) === "true"; } function isTrueTypeCollectionFile(file) { const header = file.peekBytes(4); return bytesToString(header) === "ttcf"; } function isOpenTypeFile(file) { const header = file.peekBytes(4); return bytesToString(header) === "OTTO"; } function isType1File(file) { const header = file.peekBytes(2); if (header[0] === 0x25 && header[1] === 0x21) { return true; } if (header[0] === 0x80 && header[1] === 0x01) { return true; } return false; } function isCFFFile(file) { const header = file.peekBytes(4); if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) { return true; } return false; } function getFontFileType(file, { type, subtype, composite }) { let fileType, fileSubtype; if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) { fileType = composite ? "CIDFontType2" : "TrueType"; } else if (isOpenTypeFile(file)) { fileType = composite ? "CIDFontType2" : "OpenType"; } else if (isType1File(file)) { if (composite) { fileType = "CIDFontType0"; } else { fileType = type === "MMType1" ? "MMType1" : "Type1"; } } else if (isCFFFile(file)) { if (composite) { fileType = "CIDFontType0"; fileSubtype = "CIDFontType0C"; } else { fileType = type === "MMType1" ? "MMType1" : "Type1"; fileSubtype = "Type1C"; } } else { warn("getFontFileType: Unable to detect correct font file Type/Subtype."); fileType = type; fileSubtype = subtype; } return [fileType, fileSubtype]; } function applyStandardFontGlyphMap(map, glyphMap) { for (const charCode in glyphMap) { map[+charCode] = glyphMap[charCode]; } } function buildToFontChar(encoding, glyphsUnicodeMap, differences) { const toFontChar = []; let unicode; for (let i = 0, ii = encoding.length; i < ii; i++) { unicode = getUnicodeForGlyph(encoding[i], glyphsUnicodeMap); if (unicode !== -1) { toFontChar[i] = unicode; } } for (const charCode in differences) { unicode = getUnicodeForGlyph(differences[charCode], glyphsUnicodeMap); if (unicode !== -1) { toFontChar[+charCode] = unicode; } } return toFontChar; } function isMacNameRecord(r) { return r.platform === 1 && r.encoding === 0 && r.language === 0; } function isWinNameRecord(r) { return r.platform === 3 && r.encoding === 1 && r.language === 0x409; } function convertCidString(charCode, cid, shouldThrow = false) { switch (cid.length) { case 1: return cid.charCodeAt(0); case 2: return cid.charCodeAt(0) << 8 | cid.charCodeAt(1); } const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`; if (shouldThrow) { throw new FormatError(msg); } warn(msg); return cid; } function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) { const newMap = Object.create(null); const toUnicodeExtraMap = new Map(); const toFontChar = []; const usedGlyphIds = new Set(); let privateUseAreaIndex = 0; const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0]; let nextAvailableFontCharCode = privateUseOffetStart; let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1]; const isInPrivateArea = code => PRIVATE_USE_AREAS[0][0] <= code && code <= PRIVATE_USE_AREAS[0][1] || PRIVATE_USE_AREAS[1][0] <= code && code <= PRIVATE_USE_AREAS[1][1]; for (const originalCharCode in charCodeToGlyphId) { let glyphId = charCodeToGlyphId[originalCharCode]; if (!hasGlyph(glyphId)) { continue; } if (nextAvailableFontCharCode > privateUseOffetEnd) { privateUseAreaIndex++; if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) { warn("Ran out of space in font private use area."); break; } nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0]; privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1]; } const fontCharCode = nextAvailableFontCharCode++; if (glyphId === 0) { glyphId = newGlyphZeroId; } let unicode = toUnicode.get(originalCharCode); if (typeof unicode === "string") { unicode = unicode.codePointAt(0); } if (unicode && !isInPrivateArea(unicode) && !usedGlyphIds.has(glyphId)) { toUnicodeExtraMap.set(unicode, glyphId); usedGlyphIds.add(glyphId); } newMap[fontCharCode] = glyphId; toFontChar[originalCharCode] = fontCharCode; } return { toFontChar, charCodeToGlyphId: newMap, toUnicodeExtraMap, nextAvailableFontCharCode }; } function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) { const codes = []; for (const charCode in glyphs) { if (glyphs[charCode] >= numGlyphs) { continue; } codes.push({ fontCharCode: charCode | 0, glyphId: glyphs[charCode] }); } if (toUnicodeExtraMap) { for (const [unicode, glyphId] of toUnicodeExtraMap) { if (glyphId >= numGlyphs) { continue; } codes.push({ fontCharCode: unicode, glyphId }); } } if (codes.length === 0) { codes.push({ fontCharCode: 0, glyphId: 0 }); } codes.sort(function fontGetRangesSort(a, b) { return a.fontCharCode - b.fontCharCode; }); const ranges = []; const length = codes.length; for (let n = 0; n < length;) { const start = codes[n].fontCharCode; const codeIndices = [codes[n].glyphId]; ++n; let end = start; while (n < length && end + 1 === codes[n].fontCharCode) { codeIndices.push(codes[n].glyphId); ++end; ++n; if (end === 0xffff) { break; } } ranges.push([start, end, codeIndices]); } return ranges; } function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) { const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs); const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1; let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + string32(4 + numTables * 8); let i, ii, j, jj; for (i = ranges.length - 1; i >= 0; --i) { if (ranges[i][0] <= 0xffff) { break; } } const bmpLength = i + 1; if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) { ranges[i][1] = 0xfffe; } const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0; const segCount = bmpLength + trailingRangesCount; const searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2); let startCount = ""; let endCount = ""; let idDeltas = ""; let idRangeOffsets = ""; let glyphsIds = ""; let bias = 0; let range, start, end, codes; for (i = 0, ii = bmpLength; i < ii; i++) { range = ranges[i]; start = range[0]; end = range[1]; startCount += string16(start); endCount += string16(end); codes = range[2]; let contiguous = true; for (j = 1, jj = codes.length; j < jj; ++j) { if (codes[j] !== codes[j - 1] + 1) { contiguous = false; break; } } if (!contiguous) { const offset = (segCount - i) * 2 + bias * 2; bias += end - start + 1; idDeltas += string16(0); idRangeOffsets += string16(offset); for (j = 0, jj = codes.length; j < jj; ++j) { glyphsIds += string16(codes[j]); } } else { const startCode = codes[0]; idDeltas += string16(startCode - start & 0xffff); idRangeOffsets += string16(0); } } if (trailingRangesCount > 0) { endCount += "\xFF\xFF"; startCount += "\xFF\xFF"; idDeltas += "\x00\x01"; idRangeOffsets += "\x00\x00"; } const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds; let format31012 = ""; let header31012 = ""; if (numTables > 1) { cmap += "\x00\x03" + "\x00\x0A" + string32(4 + numTables * 8 + 4 + format314.length); format31012 = ""; for (i = 0, ii = ranges.length; i < ii; i++) { range = ranges[i]; start = range[0]; codes = range[2]; let code = codes[0]; for (j = 1, jj = codes.length; j < jj; ++j) { if (codes[j] !== codes[j - 1] + 1) { end = range[0] + j - 1; format31012 += string32(start) + string32(end) + string32(code); start = end + 1; code = codes[j]; } } format31012 += string32(start) + string32(range[1]) + string32(code); } header31012 = "\x00\x0C" + "\x00\x00" + string32(format31012.length + 16) + "\x00\x00\x00\x00" + string32(format31012.length / 12); } return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012; } function validateOS2Table(os2, file) { file.pos = (file.start || 0) + os2.offset; const version = file.getUint16(); file.skip(60); const selection = file.getUint16(); if (version < 4 && selection & 0x0300) { return false; } const firstChar = file.getUint16(); const lastChar = file.getUint16(); if (firstChar > lastChar) { return false; } file.skip(6); const usWinAscent = file.getUint16(); if (usWinAscent === 0) { return false; } os2.data[8] = os2.data[9] = 0; return true; } function createOS2Table(properties, charstrings, override) { override ||= { unitsPerEm: 0, yMax: 0, yMin: 0, ascent: 0, descent: 0 }; let ulUnicodeRange1 = 0; let ulUnicodeRange2 = 0; let ulUnicodeRange3 = 0; let ulUnicodeRange4 = 0; let firstCharIndex = null; let lastCharIndex = 0; let position = -1; if (charstrings) { for (let code in charstrings) { code |= 0; if (firstCharIndex > code || !firstCharIndex) { firstCharIndex = code; } if (lastCharIndex < code) { lastCharIndex = code; } position = getUnicodeRangeFor(code, position); if (position < 32) { ulUnicodeRange1 |= 1 << position; } else if (position < 64) { ulUnicodeRange2 |= 1 << position - 32; } else if (position < 96) { ulUnicodeRange3 |= 1 << position - 64; } else if (position < 123) { ulUnicodeRange4 |= 1 << position - 96; } else { throw new FormatError("Unicode ranges Bits > 123 are reserved for internal usage"); } } if (lastCharIndex > 0xffff) { lastCharIndex = 0xffff; } } else { firstCharIndex = 0; lastCharIndex = 255; } const bbox = properties.bbox || [0, 0, 0, 0]; const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0]; const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS; const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3])); let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1])); if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) { typoDescent = -typoDescent; } const winAscent = override.yMax || typoAscent; const winDescent = -override.yMin || -typoDescent; return "\x00\x03" + "\x02\x24" + "\x01\xF4" + "\x00\x05" + "\x00\x00" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x00\x8C" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x01\xDF" + "\x00\x31" + "\x01\x02" + "\x00\x00" + "\x00\x00\x06" + String.fromCharCode(properties.fixedPitch ? 0x09 : 0x00) + "\x00\x00\x00\x00\x00\x00" + string32(ulUnicodeRange1) + string32(ulUnicodeRange2) + string32(ulUnicodeRange3) + string32(ulUnicodeRange4) + "\x2A\x32\x31\x2A" + string16(properties.italicAngle ? 1 : 0) + string16(firstCharIndex || properties.firstChar) + string16(lastCharIndex || properties.lastChar) + string16(typoAscent) + string16(typoDescent) + "\x00\x64" + string16(winAscent) + string16(winDescent) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + string16(properties.xHeight) + string16(properties.capHeight) + string16(0) + string16(firstCharIndex || properties.firstChar) + "\x00\x03"; } function createPostTable(properties) { const angle = Math.floor(properties.italicAngle * 2 ** 16); return "\x00\x03\x00\x00" + string32(angle) + "\x00\x00" + "\x00\x00" + string32(properties.fixedPitch ? 1 : 0) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00"; } function createPostscriptName(name) { return name.replaceAll(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63); } function createNameTable(name, proto) { if (!proto) { proto = [[], []]; } const strings = [proto[0][0] || "Original licence", proto[0][1] || name, proto[0][2] || "Unknown", proto[0][3] || "uniqueID", proto[0][4] || name, proto[0][5] || "Version 0.11", proto[0][6] || createPostscriptName(name), proto[0][7] || "Unknown", proto[0][8] || "Unknown", proto[0][9] || "Unknown"]; const stringsUnicode = []; let i, ii, j, jj, str; for (i = 0, ii = strings.length; i < ii; i++) { str = proto[1][i] || strings[i]; const strBufUnicode = []; for (j = 0, jj = str.length; j < jj; j++) { strBufUnicode.push(string16(str.charCodeAt(j))); } stringsUnicode.push(strBufUnicode.join("")); } const names = [strings, stringsUnicode]; const platforms = ["\x00\x01", "\x00\x03"]; const encodings = ["\x00\x00", "\x00\x01"]; const languages = ["\x00\x00", "\x04\x09"]; const namesRecordCount = strings.length * platforms.length; let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6); let strOffset = 0; for (i = 0, ii = platforms.length; i < ii; i++) { const strs = names[i]; for (j = 0, jj = strs.length; j < jj; j++) { str = strs[j]; const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset); nameTable += nameRecord; strOffset += str.length; } } nameTable += strings.join("") + stringsUnicode.join(""); return nameTable; } class Font { constructor(name, file, properties) { this.name = name; this.psName = null; this.mimetype = null; this.disableFontFace = false; this.loadedName = properties.loadedName; this.isType3Font = properties.isType3Font; this.missingFile = false; this.cssFontInfo = properties.cssFontInfo; this._charsCache = Object.create(null); this._glyphCache = Object.create(null); let isSerifFont = !!(properties.flags & FontFlags.Serif); if (!isSerifFont && !properties.isSimulatedFlags) { const baseName = name.replaceAll(/[,_]/g, "-").split("-", 1)[0], serifFonts = getSerifFonts(); for (const namePart of baseName.split("+")) { if (serifFonts[namePart]) { isSerifFont = true; break; } } } this.isSerifFont = isSerifFont; this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); this.isMonospace = !!(properties.flags & FontFlags.FixedPitch); let { type, subtype } = properties; this.type = type; this.subtype = subtype; this.systemFontInfo = properties.systemFontInfo; const matches = name.match(/^InvalidPDFjsFont_(.*)_\d+$/); this.isInvalidPDFjsFont = !!matches; if (this.isInvalidPDFjsFont) { this.fallbackName = matches[1]; } else if (this.isMonospace) { this.fallbackName = "monospace"; } else if (this.isSerifFont) { this.fallbackName = "serif"; } else { this.fallbackName = "sans-serif"; } if (this.systemFontInfo?.guessFallback) { this.systemFontInfo.guessFallback = false; this.systemFontInfo.css += `,${this.fallbackName}`; } this.differences = properties.differences; this.widths = properties.widths; this.defaultWidth = properties.defaultWidth; this.composite = properties.composite; this.cMap = properties.cMap; this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS; this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS; this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS; this.lineHeight = this.ascent - this.descent; this.fontMatrix = properties.fontMatrix; this.bbox = properties.bbox; this.defaultEncoding = properties.defaultEncoding; this.toUnicode = properties.toUnicode; this.toFontChar = []; if (properties.type === "Type3") { for (let charCode = 0; charCode < 256; charCode++) { this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode]; } return; } this.cidEncoding = properties.cidEncoding || ""; this.vertical = !!properties.vertical; if (this.vertical) { this.vmetrics = properties.vmetrics; this.defaultVMetrics = properties.defaultVMetrics; } if (!file || file.isEmpty) { if (file) { warn('Font file is empty in "' + name + '" (' + this.loadedName + ")"); } this.fallbackToSystemFont(properties); return; } [type, subtype] = getFontFileType(file, properties); if (type !== this.type || subtype !== this.subtype) { info("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`); } let data; try { switch (type) { case "MMType1": info("MMType1 font (" + name + "), falling back to Type1."); case "Type1": case "CIDFontType0": this.mimetype = "font/opentype"; const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new CFFFont(file, properties) : new Type1Font(name, file, properties); adjustWidths(properties); data = this.convert(name, cff, properties); break; case "OpenType": case "TrueType": case "CIDFontType2": this.mimetype = "font/opentype"; data = this.checkAndRepair(name, file, properties); if (this.isOpenType) { adjustWidths(properties); type = "OpenType"; } break; default: throw new FormatError(`Font ${type} is not supported`); } } catch (e) { warn(e); this.fallbackToSystemFont(properties); return; } amendFallbackToUnicode(properties); this.data = data; this.type = type; this.subtype = subtype; this.fontMatrix = properties.fontMatrix; this.widths = properties.widths; this.defaultWidth = properties.defaultWidth; this.toUnicode = properties.toUnicode; this.seacMap = properties.seacMap; } get renderer() { const renderer = FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED); return shadow(this, "renderer", renderer); } exportData(extraProperties = false) { const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES; const data = Object.create(null); let property, value; for (property of exportDataProperties) { value = this[property]; if (value !== undefined) { data[property] = value; } } return data; } fallbackToSystemFont(properties) { this.missingFile = true; const { name, type } = this; let fontName = normalizeFontName(name); const stdFontMap = getStdFontMap(), nonStdFontMap = getNonStdFontMap(); const isStandardFont = !!stdFontMap[fontName]; const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]); fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName; const fontBasicMetricsMap = getFontBasicMetrics(); const metrics = fontBasicMetricsMap[fontName]; if (metrics) { if (isNaN(this.ascent)) { this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS; } if (isNaN(this.descent)) { this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS; } if (isNaN(this.capHeight)) { this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS; } } this.bold = /bold/gi.test(fontName); this.italic = /oblique|italic/gi.test(fontName); this.black = /Black/g.test(name); const isNarrow = /Narrow/g.test(name); this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0; if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) { const cidToGidMap = properties.cidToGidMap; const map = []; applyStandardFontGlyphMap(map, getGlyphMapForStandardFonts()); if (/Arial-?Black/i.test(name)) { applyStandardFontGlyphMap(map, getSupplementalGlyphMapForArialBlack()); } else if (/Calibri/i.test(name)) { applyStandardFontGlyphMap(map, getSupplementalGlyphMapForCalibri()); } if (cidToGidMap) { for (const charCode in map) { const cid = map[charCode]; if (cidToGidMap[cid] !== undefined) { map[+charCode] = cidToGidMap[cid]; } } if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof IdentityToUnicodeMap) { this.toUnicode.forEach(function (charCode, unicodeCharCode) { const cid = map[charCode]; if (cidToGidMap[cid] === undefined) { map[+charCode] = unicodeCharCode; } }); } } if (!(this.toUnicode instanceof IdentityToUnicodeMap)) { this.toUnicode.forEach(function (charCode, unicodeCharCode) { map[+charCode] = unicodeCharCode; }); } this.toFontChar = map; this.toUnicode = new ToUnicodeMap(map); } else if (/Symbol/i.test(fontName)) { this.toFontChar = buildToFontChar(SymbolSetEncoding, getGlyphsUnicode(), this.differences); } else if (/Dingbats/i.test(fontName)) { this.toFontChar = buildToFontChar(ZapfDingbatsEncoding, getDingbatsGlyphsUnicode(), this.differences); } else if (isStandardFont) { const map = buildToFontChar(this.defaultEncoding, getGlyphsUnicode(), this.differences); if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof IdentityToUnicodeMap)) { this.toUnicode.forEach(function (charCode, unicodeCharCode) { map[+charCode] = unicodeCharCode; }); } this.toFontChar = map; } else { const glyphsUnicodeMap = getGlyphsUnicode(); const map = []; this.toUnicode.forEach((charCode, unicodeCharCode) => { if (!this.composite) { const glyphName = this.differences[charCode] || this.defaultEncoding[charCode]; const unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap); if (unicode !== -1) { unicodeCharCode = unicode; } } map[+charCode] = unicodeCharCode; }); if (this.composite && this.toUnicode instanceof IdentityToUnicodeMap) { if (/Tahoma|Verdana/i.test(name)) { applyStandardFontGlyphMap(map, getGlyphMapForStandardFonts()); } } this.toFontChar = map; } amendFallbackToUnicode(properties); this.loadedName = fontName.split("-", 1)[0]; } checkAndRepair(name, font, properties) { const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "]; function readTables(file, numTables) { const tables = Object.create(null); tables["OS/2"] = null; tables.cmap = null; tables.head = null; tables.hhea = null; tables.hmtx = null; tables.maxp = null; tables.name = null; tables.post = null; for (let i = 0; i < numTables; i++) { const table = readTableEntry(file); if (!VALID_TABLES.includes(table.tag)) { continue; } if (table.length === 0) { continue; } tables[table.tag] = table; } return tables; } function readTableEntry(file) { const tag = file.getString(4); const checksum = file.getInt32() >>> 0; const offset = file.getInt32() >>> 0; const length = file.getInt32() >>> 0; const previousPosition = file.pos; file.pos = file.start || 0; file.skip(offset); const data = file.getBytes(length); file.pos = previousPosition; if (tag === "head") { data[8] = data[9] = data[10] = data[11] = 0; data[17] |= 0x20; } return { tag, checksum, length, offset, data }; } function readOpenTypeHeader(ttf) { return { version: ttf.getString(4), numTables: ttf.getUint16(), searchRange: ttf.getUint16(), entrySelector: ttf.getUint16(), rangeShift: ttf.getUint16() }; } function readTrueTypeCollectionHeader(ttc) { const ttcTag = ttc.getString(4); assert(ttcTag === "ttcf", "Must be a TrueType Collection font."); const majorVersion = ttc.getUint16(); const minorVersion = ttc.getUint16(); const numFonts = ttc.getInt32() >>> 0; const offsetTable = []; for (let i = 0; i < numFonts; i++) { offsetTable.push(ttc.getInt32() >>> 0); } const header = { ttcTag, majorVersion, minorVersion, numFonts, offsetTable }; switch (majorVersion) { case 1: return header; case 2: header.dsigTag = ttc.getInt32() >>> 0; header.dsigLength = ttc.getInt32() >>> 0; header.dsigOffset = ttc.getInt32() >>> 0; return header; } throw new FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`); } function readTrueTypeCollectionData(ttc, fontName) { const { numFonts, offsetTable } = readTrueTypeCollectionHeader(ttc); const fontNameParts = fontName.split("+"); let fallbackData; for (let i = 0; i < numFonts; i++) { ttc.pos = (ttc.start || 0) + offsetTable[i]; const potentialHeader = readOpenTypeHeader(ttc); const potentialTables = readTables(ttc, potentialHeader.numTables); if (!potentialTables.name) { throw new FormatError('TrueType Collection font must contain a "name" table.'); } const [nameTable] = readNameTable(potentialTables.name); for (let j = 0, jj = nameTable.length; j < jj; j++) { for (let k = 0, kk = nameTable[j].length; k < kk; k++) { const nameEntry = nameTable[j][k]?.replaceAll(/\s/g, ""); if (!nameEntry) { continue; } if (nameEntry === fontName) { return { header: potentialHeader, tables: potentialTables }; } if (fontNameParts.length < 2) { continue; } for (const part of fontNameParts) { if (nameEntry === part) { fallbackData = { name: part, header: potentialHeader, tables: potentialTables }; } } } } } if (fallbackData) { warn(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`); return { header: fallbackData.header, tables: fallbackData.tables }; } throw new FormatError(`TrueType Collection does not contain "${fontName}" font.`); } function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) { if (!cmap) { warn("No cmap table available."); return { platformId: -1, encodingId: -1, mappings: [], hasShortCmap: false }; } let segment; let start = (file.start || 0) + cmap.offset; file.pos = start; file.skip(2); const numTables = file.getUint16(); let potentialTable; let canBreak = false; for (let i = 0; i < numTables; i++) { const platformId = file.getUint16(); const encodingId = file.getUint16(); const offset = file.getInt32() >>> 0; let useTable = false; if (potentialTable?.platformId === platformId && potentialTable?.encodingId === encodingId) { continue; } if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) { useTable = true; } else if (platformId === 1 && encodingId === 0) { useTable = true; } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) { useTable = true; if (!isSymbolicFont) { canBreak = true; } } else if (isSymbolicFont && platformId === 3 && encodingId === 0) { useTable = true; let correctlySorted = true; if (i < numTables - 1) { const nextBytes = file.peekBytes(2), nextPlatformId = int16(nextBytes[0], nextBytes[1]); if (nextPlatformId < platformId) { correctlySorted = false; } } if (correctlySorted) { canBreak = true; } } if (useTable) { potentialTable = { platformId, encodingId, offset }; } if (canBreak) { break; } } if (potentialTable) { file.pos = start + potentialTable.offset; } if (!potentialTable || file.peekByte() === -1) { warn("Could not find a preferred cmap table."); return { platformId: -1, encodingId: -1, mappings: [], hasShortCmap: false }; } const format = file.getUint16(); let hasShortCmap = false; const mappings = []; let j, glyphId; if (format === 0) { file.skip(2 + 2); for (j = 0; j < 256; j++) { const index = file.getByte(); if (!index) { continue; } mappings.push({ charCode: j, glyphId: index }); } hasShortCmap = true; } else if (format === 2) { file.skip(2 + 2); const subHeaderKeys = []; let maxSubHeaderKey = 0; for (let i = 0; i < 256; i++) { const subHeaderKey = file.getUint16() >> 3; subHeaderKeys.push(subHeaderKey); maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey); } const subHeaders = []; for (let i = 0; i <= maxSubHeaderKey; i++) { subHeaders.push({ firstCode: file.getUint16(), entryCount: file.getUint16(), idDelta: signedInt16(file.getByte(), file.getByte()), idRangePos: file.pos + file.getUint16() }); } for (let i = 0; i < 256; i++) { if (subHeaderKeys[i] === 0) { file.pos = subHeaders[0].idRangePos + 2 * i; glyphId = file.getUint16(); mappings.push({ charCode: i, glyphId }); } else { const s = subHeaders[subHeaderKeys[i]]; for (j = 0; j < s.entryCount; j++) { const charCode = (i << 8) + j + s.firstCode; file.pos = s.idRangePos + 2 * j; glyphId = file.getUint16(); if (glyphId !== 0) { glyphId = (glyphId + s.idDelta) % 65536; } mappings.push({ charCode, glyphId }); } } } } else if (format === 4) { file.skip(2 + 2); const segCount = file.getUint16() >> 1; file.skip(6); const segments = []; let segIndex; for (segIndex = 0; segIndex < segCount; segIndex++) { segments.push({ end: file.getUint16() }); } file.skip(2); for (segIndex = 0; segIndex < segCount; segIndex++) { segments[segIndex].start = file.getUint16(); } for (segIndex = 0; segIndex < segCount; segIndex++) { segments[segIndex].delta = file.getUint16(); } let offsetsCount = 0, offsetIndex; for (segIndex = 0; segIndex < segCount; segIndex++) { segment = segments[segIndex]; const rangeOffset = file.getUint16(); if (!rangeOffset) { segment.offsetIndex = -1; continue; } offsetIndex = (rangeOffset >> 1) - (segCount - segIndex); segment.offsetIndex = offsetIndex; offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1); } const offsets = []; for (j = 0; j < offsetsCount; j++) { offsets.push(file.getUint16()); } for (segIndex = 0; segIndex < segCount; segIndex++) { segment = segments[segIndex]; start = segment.start; const end = segment.end; const delta = segment.delta; offsetIndex = segment.offsetIndex; for (j = start; j <= end; j++) { if (j === 0xffff) { continue; } glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start]; glyphId = glyphId + delta & 0xffff; mappings.push({ charCode: j, glyphId }); } } } else if (format === 6) { file.skip(2 + 2); const firstCode = file.getUint16(); const entryCount = file.getUint16(); for (j = 0; j < entryCount; j++) { glyphId = file.getUint16(); const charCode = firstCode + j; mappings.push({ charCode, glyphId }); } } else if (format === 12) { file.skip(2 + 4 + 4); const nGroups = file.getInt32() >>> 0; for (j = 0; j < nGroups; j++) { const startCharCode = file.getInt32() >>> 0; const endCharCode = file.getInt32() >>> 0; let glyphCode = file.getInt32() >>> 0; for (let charCode = startCharCode; charCode <= endCharCode; charCode++) { mappings.push({ charCode, glyphId: glyphCode++ }); } } } else { warn("cmap table has unsupported format: " + format); return { platformId: -1, encodingId: -1, mappings: [], hasShortCmap: false }; } mappings.sort(function (a, b) { return a.charCode - b.charCode; }); for (let i = 1; i < mappings.length; i++) { if (mappings[i - 1].charCode === mappings[i].charCode) { mappings.splice(i, 1); i--; } } return { platformId: potentialTable.platformId, encodingId: potentialTable.encodingId, mappings, hasShortCmap }; } function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) { if (!header) { if (metrics) { metrics.data = null; } return; } file.pos = (file.start || 0) + header.offset; file.pos += 4; file.pos += 2; file.pos += 2; file.pos += 2; file.pos += 2; file.pos += 2; file.pos += 2; file.pos += 2; file.pos += 2; file.pos += 2; const caretOffset = file.getUint16(); file.pos += 8; file.pos += 2; let numOfMetrics = file.getUint16(); if (caretOffset !== 0) { const macStyle = int16(headTable.data[44], headTable.data[45]); if (!(macStyle & 2)) { header.data[22] = 0; header.data[23] = 0; } } if (numOfMetrics > numGlyphs) { info(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`); numOfMetrics = numGlyphs; header.data[34] = (numOfMetrics & 0xff00) >> 8; header.data[35] = numOfMetrics & 0x00ff; } const numOfSidebearings = numGlyphs - numOfMetrics; const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1); if (numMissing > 0) { const entries = new Uint8Array(metrics.length + numMissing * 2); entries.set(metrics.data); if (dupFirstEntry) { entries[metrics.length] = metrics.data[2]; entries[metrics.length + 1] = metrics.data[3]; } metrics.data = entries; } } function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) { const glyphProfile = { length: 0, sizeOfInstructions: 0 }; if (sourceStart < 0 || sourceStart >= source.length || sourceEnd > source.length || sourceEnd - sourceStart <= 12) { return glyphProfile; } const glyf = source.subarray(sourceStart, sourceEnd); const xMin = signedInt16(glyf[2], glyf[3]); const yMin = signedInt16(glyf[4], glyf[5]); const xMax = signedInt16(glyf[6], glyf[7]); const yMax = signedInt16(glyf[8], glyf[9]); if (xMin > xMax) { writeSignedInt16(glyf, 2, xMax); writeSignedInt16(glyf, 6, xMin); } if (yMin > yMax) { writeSignedInt16(glyf, 4, yMax); writeSignedInt16(glyf, 8, yMin); } const contoursCount = signedInt16(glyf[0], glyf[1]); if (contoursCount < 0) { if (contoursCount < -1) { return glyphProfile; } dest.set(glyf, destStart); glyphProfile.length = glyf.length; return glyphProfile; } let i, j = 10, flagsCount = 0; for (i = 0; i < contoursCount; i++) { const endPoint = glyf[j] << 8 | glyf[j + 1]; flagsCount = endPoint + 1; j += 2; } const instructionsStart = j; const instructionsLength = glyf[j] << 8 | glyf[j + 1]; glyphProfile.sizeOfInstructions = instructionsLength; j += 2 + instructionsLength; const instructionsEnd = j; let coordinatesLength = 0; for (i = 0; i < flagsCount; i++) { const flag = glyf[j++]; if (flag & 0xc0) { glyf[j - 1] = flag & 0x3f; } let xLength = 2; if (flag & 2) { xLength = 1; } else if (flag & 16) { xLength = 0; } let yLength = 2; if (flag & 4) { yLength = 1; } else if (flag & 32) { yLength = 0; } const xyLength = xLength + yLength; coordinatesLength += xyLength; if (flag & 8) { const repeat = glyf[j++]; if (repeat === 0) { glyf[j - 1] ^= 8; } i += repeat; coordinatesLength += repeat * xyLength; } } if (coordinatesLength === 0) { return glyphProfile; } let glyphDataLength = j + coordinatesLength; if (glyphDataLength > glyf.length) { return glyphProfile; } if (!hintsValid && instructionsLength > 0) { dest.set(glyf.subarray(0, instructionsStart), destStart); dest.set([0, 0], destStart + instructionsStart); dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2); glyphDataLength -= instructionsLength; if (glyf.length - glyphDataLength > 3) { glyphDataLength = glyphDataLength + 3 & ~3; } glyphProfile.length = glyphDataLength; return glyphProfile; } if (glyf.length - glyphDataLength > 3) { glyphDataLength = glyphDataLength + 3 & ~3; dest.set(glyf.subarray(0, glyphDataLength), destStart); glyphProfile.length = glyphDataLength; return glyphProfile; } dest.set(glyf, destStart); glyphProfile.length = glyf.length; return glyphProfile; } function sanitizeHead(head, numGlyphs, locaLength) { const data = head.data; const version = int32(data[0], data[1], data[2], data[3]); if (version >> 16 !== 1) { info("Attempting to fix invalid version in head table: " + version); data[0] = 0; data[1] = 1; data[2] = 0; data[3] = 0; } const indexToLocFormat = int16(data[50], data[51]); if (indexToLocFormat < 0 || indexToLocFormat > 1) { info("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat); const numGlyphsPlusOne = numGlyphs + 1; if (locaLength === numGlyphsPlusOne << 1) { data[50] = 0; data[51] = 0; } else if (locaLength === numGlyphsPlusOne << 2) { data[50] = 0; data[51] = 1; } else { throw new FormatError("Could not fix indexToLocFormat: " + indexToLocFormat); } } } function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) { let itemSize, itemDecode, itemEncode; if (isGlyphLocationsLong) { itemSize = 4; itemDecode = function fontItemDecodeLong(data, offset) { return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]; }; itemEncode = function fontItemEncodeLong(data, offset, value) { data[offset] = value >>> 24 & 0xff; data[offset + 1] = value >> 16 & 0xff; data[offset + 2] = value >> 8 & 0xff; data[offset + 3] = value & 0xff; }; } else { itemSize = 2; itemDecode = function fontItemDecode(data, offset) { return data[offset] << 9 | data[offset + 1] << 1; }; itemEncode = function fontItemEncode(data, offset, value) { data[offset] = value >> 9 & 0xff; data[offset + 1] = value >> 1 & 0xff; }; } const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs; const locaDataSize = itemSize * (1 + numGlyphsOut); const locaData = new Uint8Array(locaDataSize); locaData.set(loca.data.subarray(0, locaDataSize)); loca.data = locaData; const oldGlyfData = glyf.data; const oldGlyfDataLength = oldGlyfData.length; const newGlyfData = new Uint8Array(oldGlyfDataLength); let i, j; const locaEntries = []; for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) { let offset = itemDecode(locaData, j); if (offset > oldGlyfDataLength) { offset = oldGlyfDataLength; } locaEntries.push({ index: i, offset, endOffset: 0 }); } locaEntries.sort((a, b) => a.offset - b.offset); for (i = 0; i < numGlyphs; i++) { locaEntries[i].endOffset = locaEntries[i + 1].offset; } locaEntries.sort((a, b) => a.index - b.index); for (i = 0; i < numGlyphs; i++) { const { offset, endOffset } = locaEntries[i]; if (offset !== 0 || endOffset !== 0) { break; } const nextOffset = locaEntries[i + 1].offset; if (nextOffset === 0) { continue; } locaEntries[i].endOffset = nextOffset; break; } const last = locaEntries.at(-2); if (last.offset !== 0 && last.endOffset === 0) { last.endOffset = oldGlyfDataLength; } const missingGlyphs = Object.create(null); let writeOffset = 0; itemEncode(locaData, 0, writeOffset); for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) { const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid); const newLength = glyphProfile.length; if (newLength === 0) { missingGlyphs[i] = true; } if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) { maxSizeOfInstructions = glyphProfile.sizeOfInstructions; } writeOffset += newLength; itemEncode(locaData, j, writeOffset); } if (writeOffset === 0) { const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]); for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) { itemEncode(locaData, j, simpleGlyph.length); } glyf.data = simpleGlyph; } else if (dupFirstEntry) { const firstEntryLength = itemDecode(locaData, itemSize); if (newGlyfData.length > firstEntryLength + writeOffset) { glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset); } else { glyf.data = new Uint8Array(firstEntryLength + writeOffset); glyf.data.set(newGlyfData.subarray(0, writeOffset)); } glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset); itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength); } else { glyf.data = newGlyfData.subarray(0, writeOffset); } return { missingGlyphs, maxSizeOfInstructions }; } function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) { const start = (font.start || 0) + post.offset; font.pos = start; const length = post.length, end = start + length; const version = font.getInt32(); font.skip(28); let glyphNames; let valid = true; let i; switch (version) { case 0x00010000: glyphNames = MacStandardGlyphOrdering; break; case 0x00020000: const numGlyphs = font.getUint16(); if (numGlyphs !== maxpNumGlyphs) { valid = false; break; } const glyphNameIndexes = []; for (i = 0; i < numGlyphs; ++i) { const index = font.getUint16(); if (index >= 32768) { valid = false; break; } glyphNameIndexes.push(index); } if (!valid) { break; } const customNames = [], strBuf = []; while (font.pos < end) { const stringLength = font.getByte(); strBuf.length = stringLength; for (i = 0; i < stringLength; ++i) { strBuf[i] = String.fromCharCode(font.getByte()); } customNames.push(strBuf.join("")); } glyphNames = []; for (i = 0; i < numGlyphs; ++i) { const j = glyphNameIndexes[i]; if (j < 258) { glyphNames.push(MacStandardGlyphOrdering[j]); continue; } glyphNames.push(customNames[j - 258]); } break; case 0x00030000: break; default: warn("Unknown/unsupported post table version " + version); valid = false; if (propertiesObj.defaultEncoding) { glyphNames = propertiesObj.defaultEncoding; } break; } propertiesObj.glyphNames = glyphNames; return valid; } function readNameTable(nameTable) { const start = (font.start || 0) + nameTable.offset; font.pos = start; const names = [[], []], records = []; const length = nameTable.length, end = start + length; const format = font.getUint16(); const FORMAT_0_HEADER_LENGTH = 6; if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) { return [names, records]; } const numRecords = font.getUint16(); const stringsStart = font.getUint16(); const NAME_RECORD_LENGTH = 12; let i, ii; for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) { const r = { platform: font.getUint16(), encoding: font.getUint16(), language: font.getUint16(), name: font.getUint16(), length: font.getUint16(), offset: font.getUint16() }; if (isMacNameRecord(r) || isWinNameRecord(r)) { records.push(r); } } for (i = 0, ii = records.length; i < ii; i++) { const record = records[i]; if (record.length <= 0) { continue; } const pos = start + stringsStart + record.offset; if (pos + record.length > end) { continue; } font.pos = pos; const nameIndex = record.name; if (record.encoding) { let str = ""; for (let j = 0, jj = record.length; j < jj; j += 2) { str += String.fromCharCode(font.getUint16()); } names[1][nameIndex] = str; } else { names[0][nameIndex] = font.getString(record.length); } } return [names, records]; } const TTOpsStackDeltas = [0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, 1, -1, -999, 0, 1, 0, -1, -2, 0, -1, -2, -1, -1, 0, -1, -1, 0, 0, -999, -999, -1, -1, -1, -1, -2, -999, -2, -2, -999, 0, -2, -2, 0, 0, -2, 0, -2, 0, 0, 0, -2, -1, -1, 1, 1, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, 0, -999, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -999, -999, -999, -999, -999, -1, -1, -2, -2, 0, 0, 0, 0, -1, -1, -999, -2, -2, 0, 0, -1, -2, -2, 0, 0, 0, -1, -1, -1, -2]; function sanitizeTTProgram(table, ttContext) { let data = table.data; let i = 0, j, n, b, funcId, pc, lastEndf = 0, lastDeff = 0; const stack = []; const callstack = []; const functionsCalled = []; let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions; let inFDEF = false, ifLevel = 0, inELSE = 0; for (let ii = data.length; i < ii;) { const op = data[i++]; if (op === 0x40) { n = data[i++]; if (inFDEF || inELSE) { i += n; } else { for (j = 0; j < n; j++) { stack.push(data[i++]); } } } else if (op === 0x41) { n = data[i++]; if (inFDEF || inELSE) { i += n * 2; } else { for (j = 0; j < n; j++) { b = data[i++]; stack.push(b << 8 | data[i++]); } } } else if ((op & 0xf8) === 0xb0) { n = op - 0xb0 + 1; if (inFDEF || inELSE) { i += n; } else { for (j = 0; j < n; j++) { stack.push(data[i++]); } } } else if ((op & 0xf8) === 0xb8) { n = op - 0xb8 + 1; if (inFDEF || inELSE) { i += n * 2; } else { for (j = 0; j < n; j++) { b = data[i++]; stack.push(b << 8 | data[i++]); } } } else if (op === 0x2b && !tooComplexToFollowFunctions) { if (!inFDEF && !inELSE) { funcId = stack.at(-1); if (isNaN(funcId)) { info("TT: CALL empty stack (or invalid entry)."); } else { ttContext.functionsUsed[funcId] = true; if (funcId in ttContext.functionsStackDeltas) { const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId]; if (newStackLength < 0) { warn("TT: CALL invalid functions stack delta."); ttContext.hintsValid = false; return; } stack.length = newStackLength; } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) { callstack.push({ data, i, stackTop: stack.length - 1 }); functionsCalled.push(funcId); pc = ttContext.functionsDefined[funcId]; if (!pc) { warn("TT: CALL non-existent function"); ttContext.hintsValid = false; return; } data = pc.data; i = pc.i; } } } } else if (op === 0x2c && !tooComplexToFollowFunctions) { if (inFDEF || inELSE) { warn("TT: nested FDEFs not allowed"); tooComplexToFollowFunctions = true; } inFDEF = true; lastDeff = i; funcId = stack.pop(); ttContext.functionsDefined[funcId] = { data, i }; } else if (op === 0x2d) { if (inFDEF) { inFDEF = false; lastEndf = i; } else { pc = callstack.pop(); if (!pc) { warn("TT: ENDF bad stack"); ttContext.hintsValid = false; return; } funcId = functionsCalled.pop(); data = pc.data; i = pc.i; ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop; } } else if (op === 0x89) { if (inFDEF || inELSE) { warn("TT: nested IDEFs not allowed"); tooComplexToFollowFunctions = true; } inFDEF = true; lastDeff = i; } else if (op === 0x58) { ++ifLevel; } else if (op === 0x1b) { inELSE = ifLevel; } else if (op === 0x59) { if (inELSE === ifLevel) { inELSE = 0; } --ifLevel; } else if (op === 0x1c) { if (!inFDEF && !inELSE) { const offset = stack.at(-1); if (offset > 0) { i += offset - 1; } } } if (!inFDEF && !inELSE) { let stackDelta = 0; if (op <= 0x8e) { stackDelta = TTOpsStackDeltas[op]; } else if (op >= 0xc0 && op <= 0xdf) { stackDelta = -1; } else if (op >= 0xe0) { stackDelta = -2; } if (op >= 0x71 && op <= 0x75) { n = stack.pop(); if (!isNaN(n)) { stackDelta = -n * 2; } } while (stackDelta < 0 && stack.length > 0) { stack.pop(); stackDelta++; } while (stackDelta > 0) { stack.push(NaN); stackDelta--; } } } ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions; const content = [data]; if (i > data.length) { content.push(new Uint8Array(i - data.length)); } if (lastDeff > lastEndf) { warn("TT: complementing a missing function tail"); content.push(new Uint8Array([0x22, 0x2d])); } foldTTTable(table, content); } function checkInvalidFunctions(ttContext, maxFunctionDefs) { if (ttContext.tooComplexToFollowFunctions) { return; } if (ttContext.functionsDefined.length > maxFunctionDefs) { warn("TT: more functions defined than expected"); ttContext.hintsValid = false; return; } for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) { if (j > maxFunctionDefs) { warn("TT: invalid function id: " + j); ttContext.hintsValid = false; return; } if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) { warn("TT: undefined function: " + j); ttContext.hintsValid = false; return; } } } function foldTTTable(table, content) { if (content.length > 1) { let newLength = 0; let j, jj; for (j = 0, jj = content.length; j < jj; j++) { newLength += content[j].length; } newLength = newLength + 3 & ~3; const result = new Uint8Array(newLength); let pos = 0; for (j = 0, jj = content.length; j < jj; j++) { result.set(content[j], pos); pos += content[j].length; } table.data = result; table.length = newLength; } } function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) { const ttContext = { functionsDefined: [], functionsUsed: [], functionsStackDeltas: [], tooComplexToFollowFunctions: false, hintsValid: true }; if (fpgm) { sanitizeTTProgram(fpgm, ttContext); } if (prep) { sanitizeTTProgram(prep, ttContext); } if (fpgm) { checkInvalidFunctions(ttContext, maxFunctionDefs); } if (cvt && cvt.length & 1) { const cvtData = new Uint8Array(cvt.length + 1); cvtData.set(cvt.data); cvt.data = cvtData; } return ttContext.hintsValid; } font = new Stream(new Uint8Array(font.getBytes())); let header, tables; if (isTrueTypeCollectionFile(font)) { const ttcData = readTrueTypeCollectionData(font, this.name); header = ttcData.header; tables = ttcData.tables; } else { header = readOpenTypeHeader(font); tables = readTables(font, header.numTables); } let cff, cffFile; const isTrueType = !tables["CFF "]; if (!isTrueType) { const isComposite = properties.composite && (properties.cidToGidMap?.length > 0 || !(properties.cMap instanceof IdentityCMap)); if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) { cffFile = new Stream(tables["CFF "].data); cff = new CFFFont(cffFile, properties); adjustWidths(properties); return this.convert(name, cff, properties); } delete tables.glyf; delete tables.loca; delete tables.fpgm; delete tables.prep; delete tables["cvt "]; this.isOpenType = true; } else { if (!tables.loca) { throw new FormatError('Required "loca" table is not found'); } if (!tables.glyf) { warn('Required "glyf" table is not found -- trying to recover.'); tables.glyf = { tag: "glyf", data: new Uint8Array(0) }; } this.isOpenType = false; } if (!tables.maxp) { throw new FormatError('Required "maxp" table is not found'); } font.pos = (font.start || 0) + tables.maxp.offset; let version = font.getInt32(); const numGlyphs = font.getUint16(); if (version !== 0x00010000 && version !== 0x00005000) { if (tables.maxp.length === 6) { version = 0x0005000; } else if (tables.maxp.length >= 32) { version = 0x00010000; } else { throw new FormatError(`"maxp" table has a wrong version number`); } writeUint32(tables.maxp.data, 0, version); } if (properties.scaleFactors?.length === numGlyphs && isTrueType) { const { scaleFactors } = properties; const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]); const glyphs = new GlyfTable({ glyfTable: tables.glyf.data, isGlyphLocationsLong, locaTable: tables.loca.data, numGlyphs }); glyphs.scale(scaleFactors); const { glyf, loca, isLocationLong } = glyphs.write(); tables.glyf.data = glyf; tables.loca.data = loca; if (isLocationLong !== !!isGlyphLocationsLong) { tables.head.data[50] = 0; tables.head.data[51] = isLocationLong ? 1 : 0; } const metrics = tables.hmtx.data; for (let i = 0; i < numGlyphs; i++) { const j = 4 * i; const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1])); metrics[j] = advanceWidth >> 8 & 0xff; metrics[j + 1] = advanceWidth & 0xff; const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3])); writeSignedInt16(metrics, j + 2, lsb); } } let numGlyphsOut = numGlyphs + 1; let dupFirstEntry = true; if (numGlyphsOut > 0xffff) { dupFirstEntry = false; numGlyphsOut = numGlyphs; warn("Not enough space in glyfs to duplicate first glyph."); } let maxFunctionDefs = 0; let maxSizeOfInstructions = 0; if (version >= 0x00010000 && tables.maxp.length >= 32) { font.pos += 8; const maxZones = font.getUint16(); if (maxZones > 2) { tables.maxp.data[14] = 0; tables.maxp.data[15] = 2; } font.pos += 4; maxFunctionDefs = font.getUint16(); font.pos += 4; maxSizeOfInstructions = font.getUint16(); } tables.maxp.data[4] = numGlyphsOut >> 8; tables.maxp.data[5] = numGlyphsOut & 255; const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs); if (!hintsValid) { delete tables.fpgm; delete tables.prep; delete tables["cvt "]; } sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry); if (!tables.head) { throw new FormatError('Required "head" table is not found'); } sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0); let missingGlyphs = Object.create(null); if (isTrueType) { const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]); const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions); missingGlyphs = glyphsInfo.missingGlyphs; if (version >= 0x00010000 && tables.maxp.length >= 32) { tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8; tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255; } } if (!tables.hhea) { throw new FormatError('Required "hhea" table is not found'); } if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) { tables.hhea.data[10] = 0xff; tables.hhea.data[11] = 0xff; } const metricsOverride = { unitsPerEm: int16(tables.head.data[18], tables.head.data[19]), yMax: signedInt16(tables.head.data[42], tables.head.data[43]), yMin: signedInt16(tables.head.data[38], tables.head.data[39]), ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]), descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]), lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9]) }; this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm; this.descent = metricsOverride.descent / metricsOverride.unitsPerEm; this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm; if (this.cssFontInfo?.lineHeight) { this.lineHeight = this.cssFontInfo.metrics.lineHeight; this.lineGap = this.cssFontInfo.metrics.lineGap; } else { this.lineHeight = this.ascent - this.descent + this.lineGap; } if (tables.post) { readPostScriptTable(tables.post, properties, numGlyphs); } tables.post = { tag: "post", data: createPostTable(properties) }; const charCodeToGlyphId = Object.create(null); function hasGlyph(glyphId) { return !missingGlyphs[glyphId]; } if (properties.composite) { const cidToGidMap = properties.cidToGidMap || []; const isCidToGidMapEmpty = cidToGidMap.length === 0; properties.cMap.forEach(function (charCode, cid) { if (typeof cid === "string") { cid = convertCidString(charCode, cid, true); } if (cid > 0xffff) { throw new FormatError("Max size of CID is 65,535"); } let glyphId = -1; if (isCidToGidMapEmpty) { glyphId = cid; } else if (cidToGidMap[cid] !== undefined) { glyphId = cidToGidMap[cid]; } if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) { charCodeToGlyphId[charCode] = glyphId; } }); } else { const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding); const cmapPlatformId = cmapTable.platformId; const cmapEncodingId = cmapTable.encodingId; const cmapMappings = cmapTable.mappings; let baseEncoding = [], forcePostTable = false; if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) { baseEncoding = getEncoding(properties.baseEncodingName); } if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) { const glyphsUnicodeMap = getGlyphsUnicode(); for (let charCode = 0; charCode < 256; charCode++) { let glyphName; if (this.differences[charCode] !== undefined) { glyphName = this.differences[charCode]; } else if (baseEncoding.length && baseEncoding[charCode] !== "") { glyphName = baseEncoding[charCode]; } else { glyphName = StandardEncoding[charCode]; } if (!glyphName) { continue; } const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap); let unicodeOrCharCode; if (cmapPlatformId === 3 && cmapEncodingId === 1) { unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName]; } else if (cmapPlatformId === 1 && cmapEncodingId === 0) { unicodeOrCharCode = MacRomanEncoding.indexOf(standardGlyphName); } if (unicodeOrCharCode === undefined) { if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof IdentityToUnicodeMap)) { const unicode = this.toUnicode.get(charCode); if (unicode) { unicodeOrCharCode = unicode.codePointAt(0); } } if (unicodeOrCharCode === undefined) { continue; } } for (const mapping of cmapMappings) { if (mapping.charCode !== unicodeOrCharCode) { continue; } charCodeToGlyphId[charCode] = mapping.glyphId; break; } } } else if (cmapPlatformId === 0) { for (const mapping of cmapMappings) { charCodeToGlyphId[mapping.charCode] = mapping.glyphId; } forcePostTable = true; } else if (cmapPlatformId === 3 && cmapEncodingId === 0) { for (const mapping of cmapMappings) { let charCode = mapping.charCode; if (charCode >= 0xf000 && charCode <= 0xf0ff) { charCode &= 0xff; } charCodeToGlyphId[charCode] = mapping.glyphId; } } else { for (const mapping of cmapMappings) { charCodeToGlyphId[mapping.charCode] = mapping.glyphId; } } if (properties.glyphNames && (baseEncoding.length || this.differences.length)) { for (let i = 0; i < 256; ++i) { if (!forcePostTable && charCodeToGlyphId[i] !== undefined) { continue; } const glyphName = this.differences[i] || baseEncoding[i]; if (!glyphName) { continue; } const glyphId = properties.glyphNames.indexOf(glyphName); if (glyphId > 0 && hasGlyph(glyphId)) { charCodeToGlyphId[i] = glyphId; } } } } if (charCodeToGlyphId.length === 0) { charCodeToGlyphId[0] = 0; } let glyphZeroId = numGlyphsOut - 1; if (!dupFirstEntry) { glyphZeroId = 0; } if (!properties.cssFontInfo) { const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode); this.toFontChar = newMapping.toFontChar; tables.cmap = { tag: "cmap", data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut) }; if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) { tables["OS/2"] = { tag: "OS/2", data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride) }; } } if (!isTrueType) { try { cffFile = new Stream(tables["CFF "].data); const parser = new CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED); cff = parser.parse(); cff.duplicateFirstGlyph(); const compiler = new CFFCompiler(cff); tables["CFF "].data = compiler.compile(); } catch { warn("Failed to compile font " + properties.loadedName); } } if (!tables.name) { tables.name = { tag: "name", data: createNameTable(this.name) }; } else { const [namePrototype, nameRecords] = readNameTable(tables.name); tables.name.data = createNameTable(name, namePrototype); this.psName = namePrototype[0][6] || null; if (!properties.composite) { adjustTrueTypeToUnicode(properties, this.isSymbolicFont, nameRecords); } } const builder = new OpenTypeFileBuilder(header.version); for (const tableTag in tables) { builder.addTable(tableTag, tables[tableTag].data); } return builder.toArray(); } convert(fontName, font, properties) { properties.fixedPitch = false; if (properties.builtInEncoding) { adjustType1ToUnicode(properties, properties.builtInEncoding); } let glyphZeroId = 1; if (font instanceof CFFFont) { glyphZeroId = font.numGlyphs - 1; } const mapping = font.getGlyphMapping(properties); let newMapping = null; let newCharCodeToGlyphId = mapping; let toUnicodeExtraMap = null; if (!properties.cssFontInfo) { newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode); this.toFontChar = newMapping.toFontChar; newCharCodeToGlyphId = newMapping.charCodeToGlyphId; toUnicodeExtraMap = newMapping.toUnicodeExtraMap; } const numGlyphs = font.numGlyphs; function getCharCodes(charCodeToGlyphId, glyphId) { let charCodes = null; for (const charCode in charCodeToGlyphId) { if (glyphId === charCodeToGlyphId[charCode]) { (charCodes ||= []).push(charCode | 0); } } return charCodes; } function createCharCode(charCodeToGlyphId, glyphId) { for (const charCode in charCodeToGlyphId) { if (glyphId === charCodeToGlyphId[charCode]) { return charCode | 0; } } newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId; return newMapping.nextAvailableFontCharCode++; } const seacs = font.seacs; if (newMapping && SEAC_ANALYSIS_ENABLED && seacs?.length) { const matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX; const charset = font.getCharset(); const seacMap = Object.create(null); for (let glyphId in seacs) { glyphId |= 0; const seac = seacs[glyphId]; const baseGlyphName = StandardEncoding[seac[2]]; const accentGlyphName = StandardEncoding[seac[3]]; const baseGlyphId = charset.indexOf(baseGlyphName); const accentGlyphId = charset.indexOf(accentGlyphName); if (baseGlyphId < 0 || accentGlyphId < 0) { continue; } const accentOffset = { x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4], y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5] }; const charCodes = getCharCodes(mapping, glyphId); if (!charCodes) { continue; } for (const charCode of charCodes) { const charCodeToGlyphId = newMapping.charCodeToGlyphId; const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId); const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId); seacMap[charCode] = { baseFontCharCode, accentFontCharCode, accentOffset }; } } properties.seacMap = seacMap; } const unitsPerEm = 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0]; const builder = new OpenTypeFileBuilder("\x4F\x54\x54\x4F"); builder.addTable("CFF ", font.data); builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId)); builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs)); builder.addTable("head", "\x00\x01\x00\x00" + "\x00\x00\x10\x00" + "\x00\x00\x00\x00" + "\x5F\x0F\x3C\xF5" + "\x00\x00" + safeString16(unitsPerEm) + "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + "\x00\x00" + safeString16(properties.descent) + "\x0F\xFF" + safeString16(properties.ascent) + string16(properties.italicAngle ? 2 : 0) + "\x00\x11" + "\x00\x00" + "\x00\x00" + "\x00\x00"); builder.addTable("hhea", "\x00\x01\x00\x00" + safeString16(properties.ascent) + safeString16(properties.descent) + "\x00\x00" + "\xFF\xFF" + "\x00\x00" + "\x00\x00" + "\x00\x00" + safeString16(properties.capHeight) + safeString16(Math.tan(properties.italicAngle) * properties.xHeight) + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + string16(numGlyphs)); builder.addTable("hmtx", function fontFieldsHmtx() { const charstrings = font.charstrings; const cffWidths = font.cff ? font.cff.widths : null; let hmtx = "\x00\x00\x00\x00"; for (let i = 1, ii = numGlyphs; i < ii; i++) { let width = 0; if (charstrings) { const charstring = charstrings[i - 1]; width = "width" in charstring ? charstring.width : 0; } else if (cffWidths) { width = Math.ceil(cffWidths[i] || 0); } hmtx += string16(width) + string16(0); } return hmtx; }()); builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs)); builder.addTable("name", createNameTable(fontName)); builder.addTable("post", createPostTable(properties)); return builder.toArray(); } _charToGlyph(charcode, isSpace = false) { let glyph = this._glyphCache[charcode]; if (glyph?.isSpace === isSpace) { return glyph; } let fontCharCode, width, operatorListId; let widthCode = charcode; if (this.cMap?.contains(charcode)) { widthCode = this.cMap.lookup(charcode); if (typeof widthCode === "string") { widthCode = convertCidString(charcode, widthCode); } } width = this.widths[widthCode]; if (typeof width !== "number") { width = this.defaultWidth; } const vmetric = this.vmetrics?.[widthCode]; let unicode = this.toUnicode.get(charcode) || charcode; if (typeof unicode === "number") { unicode = String.fromCharCode(unicode); } let isInFont = this.toFontChar[charcode] !== undefined; fontCharCode = this.toFontChar[charcode] || charcode; if (this.missingFile) { const glyphName = this.differences[charcode] || this.defaultEncoding[charcode]; if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") { fontCharCode = 0x20; } fontCharCode = mapSpecialUnicodeValues(fontCharCode); } if (this.isType3Font) { operatorListId = fontCharCode; } let accent = null; if (this.seacMap?.[charcode]) { isInFont = true; const seac = this.seacMap[charcode]; fontCharCode = seac.baseFontCharCode; accent = { fontChar: String.fromCodePoint(seac.accentFontCharCode), offset: seac.accentOffset }; } let fontChar = ""; if (typeof fontCharCode === "number") { if (fontCharCode <= 0x10ffff) { fontChar = String.fromCodePoint(fontCharCode); } else { warn(`charToGlyph - invalid fontCharCode: ${fontCharCode}`); } } glyph = new fonts_Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont); return this._glyphCache[charcode] = glyph; } charsToGlyphs(chars) { let glyphs = this._charsCache[chars]; if (glyphs) { return glyphs; } glyphs = []; if (this.cMap) { const c = Object.create(null), ii = chars.length; let i = 0; while (i < ii) { this.cMap.readCharCode(chars, i, c); const { charcode, length } = c; i += length; const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20); glyphs.push(glyph); } } else { for (let i = 0, ii = chars.length; i < ii; ++i) { const charcode = chars.charCodeAt(i); const glyph = this._charToGlyph(charcode, charcode === 0x20); glyphs.push(glyph); } } return this._charsCache[chars] = glyphs; } getCharPositions(chars) { const positions = []; if (this.cMap) { const c = Object.create(null); let i = 0; while (i < chars.length) { this.cMap.readCharCode(chars, i, c); const length = c.length; positions.push([i, i + length]); i += length; } } else { for (let i = 0, ii = chars.length; i < ii; ++i) { positions.push([i, i + 1]); } } return positions; } get glyphCacheValues() { return Object.values(this._glyphCache); } encodeString(str) { const buffers = []; const currentBuf = []; const hasCurrentBufErrors = () => buffers.length % 2 === 1; const getCharCode = this.toUnicode instanceof IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode)); for (let i = 0, ii = str.length; i < ii; i++) { const unicode = str.codePointAt(i); if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) { i++; } if (this.toUnicode) { const charCode = getCharCode(unicode); if (charCode !== -1) { if (hasCurrentBufErrors()) { buffers.push(currentBuf.join("")); currentBuf.length = 0; } const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1; for (let j = charCodeLength - 1; j >= 0; j--) { currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff)); } continue; } } if (!hasCurrentBufErrors()) { buffers.push(currentBuf.join("")); currentBuf.length = 0; } currentBuf.push(String.fromCodePoint(unicode)); } buffers.push(currentBuf.join("")); return buffers; } } class ErrorFont { constructor(error) { this.error = error; this.loadedName = "g_font_error"; this.missingFile = true; } charsToGlyphs() { return []; } encodeString(chars) { return [chars]; } exportData(extraProperties = false) { return { error: this.error }; } } ;// CONCATENATED MODULE: ./src/core/pattern.js const ShadingType = { FUNCTION_BASED: 1, AXIAL: 2, RADIAL: 3, FREE_FORM_MESH: 4, LATTICE_FORM_MESH: 5, COONS_PATCH_MESH: 6, TENSOR_PATCH_MESH: 7 }; class Pattern { constructor() { unreachable("Cannot initialize Pattern."); } static parseShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache) { const dict = shading instanceof BaseStream ? shading.dict : shading; const type = dict.get("ShadingType"); try { switch (type) { case ShadingType.AXIAL: case ShadingType.RADIAL: return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache); case ShadingType.FREE_FORM_MESH: case ShadingType.LATTICE_FORM_MESH: case ShadingType.COONS_PATCH_MESH: case ShadingType.TENSOR_PATCH_MESH: return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache); default: throw new FormatError("Unsupported ShadingType: " + type); } } catch (ex) { if (ex instanceof MissingDataException) { throw ex; } warn(ex); return new DummyShading(); } } } class BaseShading { static SMALL_NUMBER = 1e-6; constructor() { if (this.constructor === BaseShading) { unreachable("Cannot initialize BaseShading."); } } getIR() { unreachable("Abstract method `getIR` called."); } } class RadialAxialShading extends BaseShading { constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) { super(); this.shadingType = dict.get("ShadingType"); let coordsLen = 0; if (this.shadingType === ShadingType.AXIAL) { coordsLen = 4; } else if (this.shadingType === ShadingType.RADIAL) { coordsLen = 6; } this.coordsArr = dict.getArray("Coords"); if (!isNumberArray(this.coordsArr, coordsLen)) { throw new FormatError("RadialAxialShading: Invalid /Coords array."); } const cs = ColorSpace.parse({ cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"), xref, resources, pdfFunctionFactory, localColorSpaceCache }); this.bbox = lookupNormalRect(dict.getArray("BBox"), null); let t0 = 0.0, t1 = 1.0; const domainArr = dict.getArray("Domain"); if (isNumberArray(domainArr, 2)) { [t0, t1] = domainArr; } let extendStart = false, extendEnd = false; const extendArr = dict.getArray("Extend"); if (isBooleanArray(extendArr, 2)) { [extendStart, extendEnd] = extendArr; } if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) { const [x1, y1, r1, x2, y2, r2] = this.coordsArr; const distance = Math.hypot(x1 - x2, y1 - y2); if (r1 <= r2 + distance && r2 <= r1 + distance) { warn("Unsupported radial gradient."); } } this.extendStart = extendStart; this.extendEnd = extendEnd; const fnObj = dict.getRaw("Function"); const fn = pdfFunctionFactory.createFromArray(fnObj); const NUMBER_OF_SAMPLES = 840; const step = (t1 - t0) / NUMBER_OF_SAMPLES; const colorStops = this.colorStops = []; if (t0 >= t1 || step <= 0) { info("Bad shading domain."); return; } const color = new Float32Array(cs.numComps), ratio = new Float32Array(1); let rgbColor; let iBase = 0; ratio[0] = t0; fn(ratio, 0, color, 0); let rgbBase = cs.getRgb(color, 0); const cssColorBase = Util.makeHexColor(rgbBase[0], rgbBase[1], rgbBase[2]); colorStops.push([0, cssColorBase]); let iPrev = 1; ratio[0] = t0 + step; fn(ratio, 0, color, 0); let rgbPrev = cs.getRgb(color, 0); let maxSlopeR = rgbPrev[0] - rgbBase[0] + 1; let maxSlopeG = rgbPrev[1] - rgbBase[1] + 1; let maxSlopeB = rgbPrev[2] - rgbBase[2] + 1; let minSlopeR = rgbPrev[0] - rgbBase[0] - 1; let minSlopeG = rgbPrev[1] - rgbBase[1] - 1; let minSlopeB = rgbPrev[2] - rgbBase[2] - 1; for (let i = 2; i < NUMBER_OF_SAMPLES; i++) { ratio[0] = t0 + i * step; fn(ratio, 0, color, 0); rgbColor = cs.getRgb(color, 0); const run = i - iBase; maxSlopeR = Math.min(maxSlopeR, (rgbColor[0] - rgbBase[0] + 1) / run); maxSlopeG = Math.min(maxSlopeG, (rgbColor[1] - rgbBase[1] + 1) / run); maxSlopeB = Math.min(maxSlopeB, (rgbColor[2] - rgbBase[2] + 1) / run); minSlopeR = Math.max(minSlopeR, (rgbColor[0] - rgbBase[0] - 1) / run); minSlopeG = Math.max(minSlopeG, (rgbColor[1] - rgbBase[1] - 1) / run); minSlopeB = Math.max(minSlopeB, (rgbColor[2] - rgbBase[2] - 1) / run); const slopesExist = minSlopeR <= maxSlopeR && minSlopeG <= maxSlopeG && minSlopeB <= maxSlopeB; if (!slopesExist) { const cssColor = Util.makeHexColor(rgbPrev[0], rgbPrev[1], rgbPrev[2]); colorStops.push([iPrev / NUMBER_OF_SAMPLES, cssColor]); maxSlopeR = rgbColor[0] - rgbPrev[0] + 1; maxSlopeG = rgbColor[1] - rgbPrev[1] + 1; maxSlopeB = rgbColor[2] - rgbPrev[2] + 1; minSlopeR = rgbColor[0] - rgbPrev[0] - 1; minSlopeG = rgbColor[1] - rgbPrev[1] - 1; minSlopeB = rgbColor[2] - rgbPrev[2] - 1; iBase = iPrev; rgbBase = rgbPrev; } iPrev = i; rgbPrev = rgbColor; } const cssColor = Util.makeHexColor(rgbPrev[0], rgbPrev[1], rgbPrev[2]); colorStops.push([1, cssColor]); let background = "transparent"; if (dict.has("Background")) { rgbColor = cs.getRgb(dict.get("Background"), 0); background = Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]); } if (!extendStart) { colorStops.unshift([0, background]); colorStops[1][0] += BaseShading.SMALL_NUMBER; } if (!extendEnd) { colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER; colorStops.push([1, background]); } this.colorStops = colorStops; } getIR() { const { coordsArr, shadingType } = this; let type, p0, p1, r0, r1; if (shadingType === ShadingType.AXIAL) { p0 = [coordsArr[0], coordsArr[1]]; p1 = [coordsArr[2], coordsArr[3]]; r0 = null; r1 = null; type = "axial"; } else if (shadingType === ShadingType.RADIAL) { p0 = [coordsArr[0], coordsArr[1]]; p1 = [coordsArr[3], coordsArr[4]]; r0 = coordsArr[2]; r1 = coordsArr[5]; type = "radial"; } else { unreachable(`getPattern type unknown: ${shadingType}`); } return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1]; } } class MeshStreamReader { constructor(stream, context) { this.stream = stream; this.context = context; this.buffer = 0; this.bufferLength = 0; const numComps = context.numComps; this.tmpCompsBuf = new Float32Array(numComps); const csNumComps = context.colorSpace.numComps; this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf; } get hasData() { if (this.stream.end) { return this.stream.pos < this.stream.end; } if (this.bufferLength > 0) { return true; } const nextByte = this.stream.getByte(); if (nextByte < 0) { return false; } this.buffer = nextByte; this.bufferLength = 8; return true; } readBits(n) { let buffer = this.buffer; let bufferLength = this.bufferLength; if (n === 32) { if (bufferLength === 0) { return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0; } buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte(); const nextByte = this.stream.getByte(); this.buffer = nextByte & (1 << bufferLength) - 1; return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0; } if (n === 8 && bufferLength === 0) { return this.stream.getByte(); } while (bufferLength < n) { buffer = buffer << 8 | this.stream.getByte(); bufferLength += 8; } bufferLength -= n; this.bufferLength = bufferLength; this.buffer = buffer & (1 << bufferLength) - 1; return buffer >> bufferLength; } align() { this.buffer = 0; this.bufferLength = 0; } readFlag() { return this.readBits(this.context.bitsPerFlag); } readCoordinate() { const bitsPerCoordinate = this.context.bitsPerCoordinate; const xi = this.readBits(bitsPerCoordinate); const yi = this.readBits(bitsPerCoordinate); const decode = this.context.decode; const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10; return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]]; } readComponents() { const numComps = this.context.numComps; const bitsPerComponent = this.context.bitsPerComponent; const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10; const decode = this.context.decode; const components = this.tmpCompsBuf; for (let i = 0, j = 4; i < numComps; i++, j += 2) { const ci = this.readBits(bitsPerComponent); components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j]; } const color = this.tmpCsCompsBuf; if (this.context.colorFn) { this.context.colorFn(components, 0, color, 0); } return this.context.colorSpace.getRgb(color, 0); } } let bCache = Object.create(null); function buildB(count) { const lut = []; for (let i = 0; i <= count; i++) { const t = i / count, t_ = 1 - t; lut.push(new Float32Array([t_ ** 3, 3 * t * t_ ** 2, 3 * t ** 2 * t_, t ** 3])); } return lut; } function getB(count) { return bCache[count] ||= buildB(count); } function clearPatternCaches() { bCache = Object.create(null); } class MeshShading extends BaseShading { static MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3; static MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20; static TRIANGLE_DENSITY = 20; constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) { super(); if (!(stream instanceof BaseStream)) { throw new FormatError("Mesh data is not a stream"); } const dict = stream.dict; this.shadingType = dict.get("ShadingType"); this.bbox = lookupNormalRect(dict.getArray("BBox"), null); const cs = ColorSpace.parse({ cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"), xref, resources, pdfFunctionFactory, localColorSpaceCache }); this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null; const fnObj = dict.getRaw("Function"); const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null; this.coords = []; this.colors = []; this.figures = []; const decodeContext = { bitsPerCoordinate: dict.get("BitsPerCoordinate"), bitsPerComponent: dict.get("BitsPerComponent"), bitsPerFlag: dict.get("BitsPerFlag"), decode: dict.getArray("Decode"), colorFn: fn, colorSpace: cs, numComps: fn ? 1 : cs.numComps }; const reader = new MeshStreamReader(stream, decodeContext); let patchMesh = false; switch (this.shadingType) { case ShadingType.FREE_FORM_MESH: this._decodeType4Shading(reader); break; case ShadingType.LATTICE_FORM_MESH: const verticesPerRow = dict.get("VerticesPerRow") | 0; if (verticesPerRow < 2) { throw new FormatError("Invalid VerticesPerRow"); } this._decodeType5Shading(reader, verticesPerRow); break; case ShadingType.COONS_PATCH_MESH: this._decodeType6Shading(reader); patchMesh = true; break; case ShadingType.TENSOR_PATCH_MESH:
•
Search:
•
Replace:
1
2
3
4
5
6
7
Function
Edit by line
Download
Information
Rename
Copy
Move
Delete
Chmod
List