diff options
author | Karl Berry <karl@freefriends.org> | 2017-01-31 18:37:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-01-31 18:37:40 +0000 |
commit | 4c245316c293169ee655c8e2f922b4bee454f9bc (patch) | |
tree | 2d3b72165f3e7e1298df8dad8b52f119a42228dc /Build/source/texk/dvisvgm/dvisvgm-src/src | |
parent | 54a2f67f996dceca3c89276dea798f746b3cacaf (diff) |
import original dvisvgm-2.1
git-svn-id: svn://tug.org/texlive/trunk@43102 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvisvgm/dvisvgm-src/src')
221 files changed, 6515 insertions, 5944 deletions
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/AGLTable.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/AGLTable.hpp index 42b7fff26cd..fe4e6466ac2 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/AGLTable.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/AGLTable.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** AGLTable.h ** +** AGLTable.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,16 +18,22 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ + /* The following table provides a compact mapping from PostScript character names * to Unicode points. Instead of using the character names directly it maps the * hash values (xxhash32) of the names to the corresponding code points. * The character mapping is derived from the Adobe Glyph List (AGL): * https://github.com/adobe-type-tools/agl-aglfn * http://tug.ctan.org/macros/latex/contrib/pdfx/glyphtounicode-cmr.tex */ -static struct Hash2Unicode { - UInt32 hash; - UInt32 codepoint; -} hash2unicode[] = { + +#include <array> + +struct HashCodepointPair { + uint32_t hash; + uint32_t codepoint; +}; + +std::array<HashCodepointPair, 4048> hash2unicode = {{ {0x001cf4a9, 0x0118}, // Eogonek {0x003b11fb, 0x055f}, // abbreviationmarkarmenian {0x0050a316, 0x0444}, // afii10086 @@ -51,17 +57,13 @@ static struct Hash2Unicode { {0x012d44bc, 0x05d6}, // afii57670 {0x013044fb, 0x2205}, // emptyset {0x01422ce1, 0x0486}, // psilipneumatacyrilliccmb - {0x01532d0f, 0x002f}, // slashBig {0x01571757, 0xfe6b}, // atsmall {0x01678eeb, 0x066b}, // decimalseparatorpersian {0x018643fe, 0x091a}, // cadeva {0x019e6772, 0x3148}, // cieuckorean {0x019fa822, 0x05de}, // mem - {0x01a69c0c, 0x221a}, // radicalbigg {0x01cfa7b3, 0x0a3e}, // aamatragurmukhi {0x01d7c979, 0x3007}, // ideographiczero - {0x02057d9e, 0x05e8}, // reshhatafsegol - {0x0209914d, 0xf7fe}, // Thornsmall {0x020d70ad, 0x278b}, // twocircleinversesansserif {0x0239eab1, 0x3131}, // kiyeokkorean {0x023b0c79, 0xff87}, // nukatakanahalfwidth @@ -84,15 +86,12 @@ static struct Hash2Unicode { {0x02dab625, 0x310c}, // lbopomofo {0x02df8edf, 0x30e7}, // yosmallkatakana {0x02e3dfc8, 0x3062}, // dihiragana - {0x02f13fd7, 0x0029}, // parenrightbig - {0x02f32b9b, 0x002f}, // slashbigg {0x0306380d, 0xff35}, // Umonospace {0x03170204, 0x0495}, // ghemiddlehookcyrillic {0x03182c9f, 0x25b4}, // blackuppointingsmalltriangle {0x0319d343, 0x329e}, // ideographicprintcircle {0x031ad266, 0x331e}, // kooposquare {0x03274b72, 0x0018}, // controlCAN - {0x032ef9aa, 0xf7f6}, // Odieresissmall {0x0334c4d5, 0x0aa7}, // dhagujarati {0x03396436, 0x1ed0}, // Ocircumflexacute {0x033b64c4, 0x047f}, // otcyrillic @@ -105,7 +104,6 @@ static struct Hash2Unicode { {0x03c2a8d8, 0x1eb3}, // abrevehookabove {0x03d234c7, 0xfea7}, // khahinitialarabic {0x03f4da1a, 0x05b8}, // qamatsnarrowhebrew - {0x040b8001, 0x230a}, // floorleftBig {0x0410b525, 0x0138}, // kgreenlandic {0x0433eb22, 0x014e}, // Obreve {0x043f3fc5, 0x040a}, // afii10059 @@ -121,7 +119,6 @@ static struct Hash2Unicode { {0x04c8ee7d, 0x042d}, // Ereversedcyrillic {0x04de1db0, 0x0950}, // omdeva {0x04f4d676, 0x0027}, // quotesingle - {0x04fb1584, 0xf6c4}, // afii10063 {0x0500f909, 0x0407}, // Yicyrillic {0x0503fcb5, 0x00b1}, // plusminus {0x05116c6a, 0x30fc}, // prolongedkana @@ -136,7 +133,6 @@ static struct Hash2Unicode { {0x05a47299, 0x320d}, // hieuhparenkorean {0x05a53e96, 0x0282}, // shook {0x05b0f8c3, 0x02b5}, // rhookturnedsuperior - {0x05c5a128, 0xf76b}, // Ksmall {0x05cee53c, 0x201d}, // quotedblright {0x05de47fd, 0x1e7f}, // vdotbelow {0x05e340f3, 0x1e70}, // Tcircumflexbelow @@ -144,10 +140,7 @@ static struct Hash2Unicode { {0x05ec5d36, 0x2471}, // eighteencircle {0x05f03fff, 0x0ae0}, // rrvocalicgujarati {0x060beb03, 0x0175}, // wcircumflex - {0x0618af48, 0x005c}, // backslashBig {0x061ad8fc, 0x24ca}, // Ucircle - {0x061f0bd8, 0x2a00}, // circledotdisplay - {0x062d146d, 0xf88b}, // maieklowrightthai {0x0642035b, 0x0010}, // controlDLE {0x0646584a, 0x003d}, // equal {0x064874b1, 0x05d3}, // afii57667 @@ -158,7 +151,6 @@ static struct Hash2Unicode { {0x06b00ffc, 0x0101}, // amacron {0x06b72f51, 0x27e8}, // angbracketleftbig {0x06be8647, 0x0442}, // afii10084 - {0x06e56a17, 0x05dc}, // lamedholamdagesh {0x06ec3366, 0xfe42}, // cornerbracketrightvertical {0x0700a693, 0x0475}, // izhitsacyrillic {0x07019244, 0xfb02}, // fl @@ -178,7 +170,6 @@ static struct Hash2Unicode { {0x0793d50d, 0x30bb}, // sekatakana {0x07a1ce35, 0x0906}, // aadeva {0x07ab20a8, 0x0ab3}, // llagujarati - {0x07b2b22c, 0x02c6}, // hatwidest {0x07e20c30, 0x017b}, // Zdot {0x07e38c67, 0x33bb}, // nwsquare {0x081dd122, 0x0a38}, // sagurmukhi @@ -189,8 +180,6 @@ static struct Hash2Unicode { {0x085499c4, 0x0925}, // thadeva {0x086a99d9, 0x01af}, // Uhorn {0x087038eb, 0xfb20}, // ayinaltonehebrew - {0x08729ac0, 0xed18}, // bracehtipdownright - {0x08905fd6, 0x230b}, // floorrightbigg {0x089d739a, 0x005a}, // Z {0x08a131c8, 0x096d}, // sevendeva {0x08a6b099, 0x02a6}, // ts @@ -205,16 +194,13 @@ static struct Hash2Unicode { {0x09751504, 0x038c}, // Omicrontonos {0x09790f28, 0x33be}, // kwsquare {0x09853aa3, 0x01c1}, // clicklateral - {0x099430b2, 0xf7f5}, // Otildesmall {0x09a03740, 0xfe5b}, // braceleftsmall {0x09a4b050, 0x0ae8}, // twogujarati - {0x09adf253, 0xf721}, // exclamsmall {0x09d4b5eb, 0x3388}, // calsquare {0x09f2217d, 0x00a9}, // copyright {0x09f9df24, 0x1e0c}, // Ddotbelow {0x0a040d76, 0x098a}, // uubengali {0x0a1d800c, 0x0291}, // zcurl - {0x0a3a2809, 0xf767}, // Gsmall {0x0a3b8eb5, 0x044b}, // yericyrillic {0x0a46f2f1, 0x0284}, // dotlessjstrokehook {0x0a5cb3b1, 0x30d6}, // bukatakana @@ -225,12 +211,9 @@ static struct Hash2Unicode { {0x0a9b47dd, 0x306f}, // hahiragana {0x0aa2156d, 0xfc0c}, // tehhahisolatedarabic {0x0abb4ec1, 0x0441}, // afii10083 - {0x0ac66fc0, 0x005b}, // bracketleftBigg {0x0adbba15, 0x21c0}, // harpoonrightbarbup {0x0ae79191, 0x01e1}, // adotmacron - {0x0aecd30e, 0x05e8}, // reshpatahhebrew {0x0af77d49, 0x09ea}, // fourbengali - {0x0b1d2d0d, 0xf6f3}, // tsuperior {0x0b367d7a, 0x0421}, // Escyrillic {0x0b4b7082, 0xff62}, // cornerbracketlefthalfwidth {0x0b6abf22, 0x20aa}, // sheqel @@ -263,7 +246,6 @@ static struct Hash2Unicode { {0x0cf04968, 0x02be}, // ringhalfright {0x0d0eb2f0, 0x315d}, // weokorean {0x0d21bb72, 0x2550}, // SF430000 - {0x0d3a66b8, 0x2309}, // ceilingrightbigg {0x0d47308f, 0x05d4}, // he {0x0d747cfe, 0x04c3}, // Kahookcyrillic {0x0d932b5b, 0x30d2}, // hikatakana @@ -294,7 +276,6 @@ static struct Hash2Unicode { {0x0efc1459, 0x09b6}, // shabengali {0x0f02712c, 0x00ea}, // ecircumflex {0x0f066e82, 0x33b3}, // mssquare - {0x0f13ed93, 0xf7f8}, // Oslashsmall {0x0f1a6991, 0x24c4}, // Ocircle {0x0f2768b1, 0x05b1}, // hatafsegolwidehebrew {0x0f332d5e, 0x002e}, // period @@ -359,26 +340,20 @@ static struct Hash2Unicode { {0x12bdd9c7, 0x21a6}, // mapsto {0x12d3e8f7, 0x30c0}, // dakatakana {0x12def4bb, 0xfeba}, // sadfinalarabic - {0x12e14144, 0xf726}, // ampersandsmall {0x12e22bb8, 0x33c2}, // amsquare {0x1329e467, 0x0311}, // breveinvertedcmb {0x132b7bd0, 0x2a04}, // unionmultitext {0x132e0697, 0x01b3}, // Yhook - {0x13402162, 0xf6be}, // dotlessj {0x134d9c31, 0x304c}, // gahiragana {0x13597fb3, 0x04d9}, // afii10846 {0x135d6341, 0x33c8}, // dbsquare {0x13635045, 0x0300}, // gravecmb - {0x1367bcdf, 0xf88a}, // maiekupperleftthai {0x1369554a, 0x207f}, // nsuperior - {0x136e8d95, 0xf885}, // saraileftthai {0x1376f153, 0x0403}, // afii10052 {0x1384d3da, 0x05b4}, // hiriqnarrowhebrew {0x13868087, 0x0636}, // afii57430 - {0x138b1601, 0x0621}, // hamzafathatanarabic {0x138fca68, 0x0a30}, // ragurmukhi {0x13a69297, 0x0917}, // gadeva - {0x13bc5cc6, 0xf88d}, // maithoupperleftthai {0x13bcc567, 0x25d1}, // circlewithrighthalfblack {0x13ccaf5f, 0x3061}, // tihiragana {0x13dc1f9e, 0x05b1}, // hatafsegol @@ -387,7 +362,6 @@ static struct Hash2Unicode { {0x14117f5a, 0x1e77}, // ucircumflexbelow {0x141d63ad, 0x1eda}, // Ohornacute {0x142c024d, 0x013a}, // lacute - {0x142c46b3, 0x2a06}, // unionsqdisplay {0x143d707c, 0x05a6}, // merkhakefulalefthebrew {0x146c75cf, 0x3275}, // ieungacirclekorean {0x146f18bb, 0xfb36}, // zayindagesh @@ -398,12 +372,10 @@ static struct Hash2Unicode { {0x14c795cf, 0x0051}, // Q {0x14d1cd4b, 0x2284}, // notsubset {0x14d2cd8a, 0x012f}, // iogonek - {0x14eb6d31, 0x02dc}, // tildewider {0x14f2bc91, 0x1eab}, // acircumflextilde {0x15045632, 0x05d1}, // bet {0x1505dc02, 0x3083}, // yasmallhiragana {0x152785c0, 0x30a1}, // asmallkatakana - {0x1532a7b6, 0x05e7}, // qofsegolhebrew {0x15642935, 0x23a9}, // braceleftbt {0x1564e3f1, 0x05b9}, // holam26 {0x15771621, 0x042c}, // Softsigncyrillic @@ -415,10 +387,8 @@ static struct Hash2Unicode { {0x15f8ec13, 0x037e}, // questiongreek {0x1602acd3, 0xff38}, // Xmonospace {0x1610c2ad, 0x3181}, // yesieungkorean - {0x161db4d0, 0xf76c}, // Lsmall {0x16393f6d, 0xfef6}, // lamalefmaddaabovefinalarabic {0x164a5cd1, 0x0058}, // X - {0x164b6531, 0xf7eb}, // Edieresissmall {0x165341dd, 0x02e0}, // gammasuperior {0x167b1fac, 0xfebc}, // sadmedialarabic {0x168b9d05, 0x04d5}, // aiecyrillic @@ -432,7 +402,6 @@ static struct Hash2Unicode { {0x170fc75c, 0x306c}, // nuhiragana {0x171b516a, 0x0a39}, // hagurmukhi {0x17301afd, 0x3023}, // threehangzhou - {0x17314b3c, 0xf7a8}, // Dieresissmall {0x173c8456, 0x338b}, // nfsquare {0x178d45ae, 0x337e}, // meizierasquare {0x17a9e49b, 0x322a}, // ideographicmoonparen @@ -453,10 +422,7 @@ static struct Hash2Unicode { {0x185b816d, 0x0146}, // ncommaaccent {0x187ab455, 0x0e42}, // saraothai {0x1885706c, 0x3157}, // okorean - {0x18905b85, 0x05e8}, // reshsegol {0x18923bff, 0x2135}, // aleph - {0x1892a13e, 0x005d}, // bracketrightbigg - {0x18a1a8e1, 0x02c2}, // a40 {0x18a5c10a, 0x2584}, // dnblock {0x18a72a69, 0xfb3a}, // finalkafdageshhebrew {0x18b82c53, 0x045c}, // afii10109 @@ -467,10 +433,8 @@ static struct Hash2Unicode { {0x18ea53c7, 0x0663}, // afii57395 {0x18ec3f78, 0x05e8}, // afii57688 {0x18f0d507, 0xfe9f}, // jeeminitialarabic - {0x18fb8128, 0x25c1}, // a1 {0x190a56aa, 0xfe5a}, // parenrightsmall {0x1920c2c2, 0xff65}, // middledotkatakanahalfwidth - {0x1925bd4b, 0xf6f9}, // Lslashsmall {0x192c8826, 0x2283}, // superset {0x1940b4fd, 0x2251}, // geometricallyequal {0x19427103, 0x2a01}, // circleplustext @@ -478,7 +442,6 @@ static struct Hash2Unicode { {0x194ec3dd, 0xfb38}, // tetdageshhebrew {0x195fdeed, 0x3013}, // getamark {0x197f461f, 0x1e03}, // bdotaccent - {0x1991ce27, 0x007b}, // braceleftBigg {0x1994a487, 0x0481}, // koppacyrillic {0x19985117, 0x339a}, // nmsquare {0x19a1a98b, 0x00ad}, // sfthyphen @@ -493,7 +456,6 @@ static struct Hash2Unicode { {0x1a00d3da, 0x032b}, // dblarchinvertedbelowcmb {0x1a260946, 0x0447}, // checyrillic {0x1a287ed9, 0x0922}, // ddhadeva - {0x1a28dcc1, 0x005b}, // bracketleftBig {0x1a3b33cb, 0xfed7}, // qafinitialarabic {0x1a3bf649, 0x05b2}, // hatafpatahhebrew {0x1a4f3484, 0x0913}, // odeva @@ -517,7 +479,6 @@ static struct Hash2Unicode { {0x1c16ebae, 0x0126}, // Hbar {0x1c2631dd, 0x3385}, // KBsquare {0x1c56e166, 0xfd3f}, // parenrightaltonearabic - {0x1c70f0f3, 0xf7e7}, // Ccedillasmall {0x1c94529b, 0x21b5}, // carriagereturn {0x1cb10674, 0x0a27}, // dhagurmukhi {0x1cb5367a, 0x0532}, // Benarmenian @@ -529,7 +490,6 @@ static struct Hash2Unicode { {0x1d2559c8, 0x03b9}, // iota {0x1d25e3ef, 0x043c}, // emcyrillic {0x1d420ccb, 0x0430}, // afii10065 - {0x1d91efe5, 0xf6d8}, // dieresisgrave {0x1d954d85, 0x09a4}, // tabengali {0x1da7ae8c, 0x00d7}, // multiply {0x1db92094, 0x053d}, // Xeharmenian @@ -541,7 +501,6 @@ static struct Hash2Unicode { {0x1df7638a, 0x00e4}, // adieresis {0x1dfc2837, 0x217a}, // elevenroman {0x1e0312fa, 0x0290}, // zretroflexhook - {0x1e065c3a, 0xf7f1}, // Ntildesmall {0x1e1332fd, 0x0287}, // tturned {0x1e25355a, 0x0461}, // omegacyrillic {0x1e38c8d8, 0x012a}, // Imacron @@ -558,12 +517,9 @@ static struct Hash2Unicode { {0x1edf9913, 0x1e16}, // Emacronacute {0x1ef123d5, 0x0413}, // Gecyrillic {0x1f06ae25, 0xfb31}, // betdageshhebrew - {0x1f0c6a2a, 0x0651}, // shaddafathatanarabic {0x1f1df6d1, 0x3381}, // nasquare {0x1f2383d4, 0x0004}, // controlEOT {0x1f2a4214, 0xfdfa}, // sallallahoualayhewasallamarabic - {0x1f5314ee, 0xf6fc}, // Ringsmall - {0x1f5dc79d, 0xf7b4}, // Acutesmall {0x1f60dad4, 0x05e8}, // reshhebrew {0x1f686fbe, 0xff2c}, // Lmonospace {0x1f90aeb4, 0xff7b}, // sakatakanahalfwidth @@ -577,16 +533,13 @@ static struct Hash2Unicode { {0x1feea4ab, 0x0623}, // afii57411 {0x20061138, 0x1e02}, // Bdotaccent {0x200e9513, 0x030f}, // dblgravecmb - {0x2012c16a, 0xf6d4}, // cyrbreve {0x201a6676, 0x2310}, // logicalnotreversed {0x201e3ee9, 0x0310}, // candrabinducmb {0x2024cfd1, 0x0475}, // afii10196 {0x2038e6d5, 0x307a}, // pehiragana {0x205d0ec7, 0x03a0}, // Pi - {0x206a255a, 0xf775}, // Usmall {0x207bf81e, 0xff84}, // tokatakanahalfwidth {0x2086c569, 0x00d2}, // Ograve - {0x2086fb87, 0xf772}, // Rsmall {0x208b3b40, 0xfed0}, // ghainmedialarabic {0x209bfca6, 0x24d5}, // fcircle {0x20a31ebd, 0x2489}, // twoperiod @@ -624,13 +577,11 @@ static struct Hash2Unicode { {0x2274db8f, 0xff08}, // parenleftmonospace {0x2282e86d, 0x00fa}, // uacute {0x22a883d2, 0x25c7}, // whitediamond - {0x22b082b8, 0x005c}, // backslashBigg {0x22c93a2b, 0x338d}, // mugsquare {0x22e3ac9e, 0xff4c}, // lmonospace {0x2320c842, 0x0277}, // omegalatinclosed {0x2324e69c, 0x2665}, // heart {0x2351e945, 0x0a8a}, // uugujarati - {0x2352b38c, 0xf6d7}, // dieresisacute {0x2356706f, 0x0541}, // Jaarmenian {0x23679572, 0x1ef1}, // uhorndotbelow {0x236d79e4, 0x301e}, // quotedblprime @@ -648,7 +599,6 @@ static struct Hash2Unicode { {0x2415f58f, 0x3069}, // dohiragana {0x2419b09a, 0x038f}, // Omegatonos {0x241b0583, 0x0a9e}, // nyagujarati - {0x241cc39b, 0x007b}, // braceleftbigg {0x241f6494, 0x3105}, // bbopomofo {0x2459d6f7, 0x0aea}, // fourgujarati {0x24688db0, 0x02c1}, // glottalstopreversedmod @@ -664,11 +614,9 @@ static struct Hash2Unicode { {0x24f5be18, 0x0308}, // dieresiscmb {0x2527d2da, 0x300c}, // cornerbracketleft {0x252ef6ac, 0x01de}, // Adieresismacron - {0x2533ec5c, 0x05e8}, // reshtsere {0x253f33be, 0x006e}, // n {0x2543ce81, 0x05c1}, // shindothebrew {0x254b8857, 0x0929}, // nnnadeva - {0x2556a01a, 0x005c}, // backslashbigg {0x25725d01, 0x0496}, // Zhedescendercyrillic {0x2592eb8c, 0x1e39}, // ldotbelowmacron {0x25a29a9e, 0x000a}, // controlLF @@ -697,11 +645,10 @@ static struct Hash2Unicode { {0x26b9c1d9, 0x0e30}, // saraathai {0x26c43ea8, 0x0911}, // ocandradeva {0x26caa803, 0x21d4}, // arrowdblboth - {0x26cb382e, 0xf8fc}, // bracerighttp + {0x26cb382e, 0x23ab}, // bracerighttp {0x26f6f992, 0x04e4}, // Idieresiscyrillic {0x26fb496b, 0x3351}, // rittorusquare {0x27075678, 0x012e}, // Iogonek - {0x271cd3fa, 0x27e8}, // angbracketleftBig {0x2731451f, 0x0408}, // afii10057 {0x273977ae, 0x0435}, // afii10070 {0x27487450, 0x007e}, // asciitilde @@ -719,25 +666,20 @@ static struct Hash2Unicode { {0x283f3216, 0x2075}, // fivesuperior {0x28898020, 0x0281}, // Rsmallinverted {0x288edd59, 0x24cc}, // Wcircle - {0x2892f3ea, 0x2a02}, // circlemultiplydisplay {0x28d9fe2f, 0x0e41}, // saraaethai {0x28dd4931, 0x3234}, // ideographicnameparen {0x28e31924, 0x0a6c}, // sixgurmukhi {0x28e4057d, 0xfc58}, // yehmeemisolatedarabic {0x28f71acd, 0x0633}, // afii57427 {0x290ed42e, 0x1e18}, // Ecircumflexbelow - {0x2916bf1f, 0xf7ef}, // Idieresissmall {0x29287ce1, 0x03d2}, // Upsilon1 {0x29346ac3, 0x2021}, // daggerdbl {0x29371ded, 0x1e8f}, // ydotaccent - {0x2951ba53, 0xf6e2}, // commasuperior {0x29734fd7, 0x092d}, // bhadeva {0x298e1b46, 0x01ea}, // Oogonek {0x29958ce9, 0x0005}, // controlENQ {0x29a8f130, 0x04d4}, // Aiecyrillic {0x29ab0eda, 0x0146}, // ncedilla - {0x29b0158e, 0x05e7}, // qofshevahebrew - {0x29be1625, 0x0028}, // parenleftbig {0x29c07bd0, 0x305e}, // zohiragana {0x29d0597d, 0x262f}, // yinyang {0x29d51dd2, 0x06d1}, // yehthreedotsbelowarabic @@ -756,14 +698,11 @@ static struct Hash2Unicode { {0x2a8e7779, 0x0ad0}, // omgujarati {0x2ac0e180, 0x33a6}, // kmcubedsquare {0x2ac17d0f, 0x00f3}, // oacute - {0x2acd450a, 0x002f}, // slashbig - {0x2ad04347, 0xed12}, // arrowvertexdbl {0x2ae749c7, 0x00e1}, // aacute {0x2ae8215f, 0x001d}, // controlGS {0x2ae8c5a6, 0x21c4}, // arrowrightoverleft {0x2aedcd2c, 0x09fa}, // issharbengali {0x2afb134c, 0xfb03}, // ffi - {0x2b2385f1, 0xf760}, // Gravesmall {0x2b27655e, 0x261c}, // pointingindexleftwhite {0x2b3ff353, 0x2557}, // SF250000 {0x2b42ad49, 0xfe55}, // colonsmall @@ -774,7 +713,6 @@ static struct Hash2Unicode { {0x2b9750e3, 0x2200}, // universal {0x2b9c968a, 0x0315}, // commaaboverightcmb {0x2bb5189c, 0x25e3}, // blacklowerlefttriangle - {0x2bb9b9bf, 0x0621}, // hamzafathaarabic {0x2bd253b1, 0x09bf}, // ivowelsignbengali {0x2be6415c, 0x05b3}, // hatafqamatshebrew {0x2beb7c62, 0x013c}, // lcommaaccent @@ -789,7 +727,6 @@ static struct Hash2Unicode { {0x2cdfcd2a, 0x30cb}, // nikatakana {0x2cf9daf5, 0x3228}, // nineideographicparen {0x2d2e3883, 0x2190}, // arrowleft - {0x2d317780, 0xf778}, // Xsmall {0x2d329c65, 0xfb3c}, // lameddageshhebrew {0x2d39ea69, 0x019e}, // nlegrightlong {0x2d3b565d, 0x05ea}, // afii57690 @@ -803,11 +740,9 @@ static struct Hash2Unicode { {0x2d9b14ff, 0xfb6d}, // vehmedialarabic {0x2da2ea79, 0x313d}, // rieulsioskorean {0x2daa1b6f, 0x090a}, // uudeva - {0x2db9bc28, 0xf7e3}, // Atildesmall {0x2e04353d, 0x1ea9}, // acircumflexhookabove {0x2e043b05, 0xff0a}, // asteriskmonospace {0x2e10a2b1, 0x0374}, // numeralsigngreek - {0x2e1b300e, 0x05e8}, // reshpatah {0x2e1eaa7d, 0xfb49}, // shindagesh {0x2e2c25c0, 0x0392}, // Beta {0x2e356485, 0x09c2}, // uuvowelsignbengali @@ -816,7 +751,6 @@ static struct Hash2Unicode { {0x2e647759, 0x33d6}, // molsquare {0x2e7c6436, 0x3048}, // ehiragana {0x2e915a9d, 0xfe3b}, // blacklenticularbracketleftvertical - {0x2e9d6cac, 0xf7f0}, // Ethsmall {0x2e9e14a6, 0x0454}, // ecyrillic {0x2e9ef541, 0x0192}, // florin {0x2ea8b970, 0x327a}, // phieuphacirclekorean @@ -830,7 +764,6 @@ static struct Hash2Unicode { {0x2f06c380, 0x0a91}, // ocandragujarati {0x2f0e722f, 0x0021}, // exclam {0x2f14e4ad, 0x0183}, // btopbar - {0x2f1fd59c, 0xf6d1}, // cyrBreve {0x2f22b335, 0x305f}, // tahiragana {0x2f247a45, 0x00b5}, // mu {0x2f42e9c9, 0x0405}, // afii10054 @@ -863,7 +796,6 @@ static struct Hash2Unicode { {0x30c9bc6e, 0x0a1e}, // nyagurmukhi {0x30cd38cb, 0x33d8}, // pmsquare {0x30d25d42, 0x2089}, // nineinferior - {0x30e6287a, 0x05e7}, // qofhatafpatah {0x30eada85, 0x2219}, // bulletoperator {0x30f64fef, 0x20aa}, // sheqelhebrew {0x310a4774, 0x337f}, // corporationsquare @@ -877,7 +809,6 @@ static struct Hash2Unicode { {0x31f928de, 0x05df}, // finalnun {0x31fab77d, 0x1eea}, // Uhorngrave {0x3207407e, 0x046b}, // yusbigcyrillic - {0x3225e9b9, 0x05dc}, // lamedholamhebrew {0x3238fa28, 0x3004}, // jis {0x323ea229, 0x33ac}, // gpasquare {0x324496b3, 0x33bf}, // mwmegasquare @@ -885,7 +816,6 @@ static struct Hash2Unicode { {0x324bc39e, 0x22da}, // lessequalorgreater {0x3266451e, 0x30f2}, // wokatakana {0x326ca1fd, 0x013f}, // Ldot - {0x328fa9de, 0x230b}, // floorrightBigg {0x32930f95, 0x046f}, // ksicyrillic {0x329a975f, 0x0a0a}, // uugurmukhi {0x329ed55c, 0x04e1}, // dzeabkhasiancyrillic @@ -896,8 +826,6 @@ static struct Hash2Unicode { {0x330263f2, 0x3136}, // nieunhieuhkorean {0x3303dbcb, 0x04b2}, // Hadescendercyrillic {0x33042de7, 0x1e90}, // Zcircumflex - {0x33231bf5, 0x27e8}, // angbracketleftbigg - {0x335a816e, 0xf739}, // nineoldstyle {0x335e3259, 0x3022}, // twohangzhou {0x336106b8, 0x05d7}, // afii57671 {0x33821f87, 0x05e2}, // ayinhebrew @@ -909,7 +837,6 @@ static struct Hash2Unicode { {0x33ea63c8, 0x24df}, // pcircle {0x33f59002, 0x0285}, // eshsquatreversed {0x340746a2, 0xff4a}, // jmonospace - {0x340dcbd1, 0x21d1}, // arrowdbltp {0x3425ba3a, 0x056d}, // xeharmenian {0x342d52b5, 0x25cb}, // whitecircle {0x34399add, 0x0034}, // four @@ -920,7 +847,6 @@ static struct Hash2Unicode { {0x345791f2, 0x027c}, // rlongleg {0x346086da, 0x2286}, // reflexsubset {0x3463147c, 0x1e69}, // sdotbelowdotaccent - {0x3471790f, 0xf6f7}, // Dotaccentsmall {0x3490ad97, 0x047a}, // Omegaroundcyrillic {0x34a7b989, 0x006f}, // o {0x34a88183, 0x2640}, // female @@ -928,7 +854,6 @@ static struct Hash2Unicode { {0x34bab99c, 0x24e0}, // qcircle {0x34c88fb4, 0x2312}, // arc {0x34c908a5, 0x1eb4}, // Abrevetilde - {0x34d1f962, 0x05e8}, // reshholamhebrew {0x34df3d1c, 0x00a1}, // exclamdown {0x34e969fb, 0x05a0}, // telishagedolahebrew {0x34f9cd37, 0x010b}, // cdot @@ -940,7 +865,6 @@ static struct Hash2Unicode { {0x35440d94, 0x040c}, // Kjecyrillic {0x354dad21, 0x0129}, // itilde {0x35514624, 0x00d6}, // Odieresis - {0x357c478e, 0xf736}, // sixoldstyle {0x3596098d, 0xfb9f}, // noonghunnafinalarabic {0x359e9c03, 0x0418}, // Iicyrillic {0x359f6846, 0x1ebc}, // Etilde @@ -953,10 +877,8 @@ static struct Hash2Unicode { {0x361cb4c9, 0xfb6b}, // vehfinalarabic {0x361e70b8, 0x0043}, // C {0x362459fb, 0xfe97}, // tehinitialarabic - {0x362bfa3a, 0xf732}, // twooldstyle {0x362c9d3a, 0x02b0}, // hsuperior {0x36678fdf, 0x2326}, // deleteright - {0x3673a47b, 0x05e7}, // qofqamatshebrew {0x3676afc0, 0x0ac9}, // ocandravowelsigngujarati {0x368bf72e, 0x0038}, // eight {0x36aaad0e, 0x307b}, // hohiragana @@ -965,8 +887,6 @@ static struct Hash2Unicode { {0x37117bac, 0x059b}, // tevirlefthebrew {0x372986de, 0x05f3}, // gereshhebrew {0x373e5e3f, 0xff27}, // Gmonospace - {0x37497fde, 0x25b7}, // a3 - {0x3781d925, 0xf6ed}, // isuperior {0x37866f5c, 0x00df}, // germandbls {0x37a73b5a, 0xfee0}, // lammedialarabic {0x37a77cc1, 0x030b}, // hungarumlautcmb @@ -978,7 +898,6 @@ static struct Hash2Unicode { {0x37e460db, 0x308d}, // rohiragana {0x37e5061e, 0x04a3}, // endescendercyrillic {0x37f67ca7, 0x029a}, // eopenclosed - {0x380974a8, 0xf735}, // fiveoldstyle {0x381040c4, 0x310d}, // gbopomofo {0x381640e0, 0xffe3}, // macronmonospace {0x381c7e4d, 0x1ece}, // Ohookabove @@ -990,7 +909,6 @@ static struct Hash2Unicode { {0x38746563, 0x01b0}, // uhorn {0x38880d1d, 0x0198}, // Khook {0x38885f68, 0x091d}, // jhadeva - {0x3889a61f, 0x005b}, // bracketleftbigg {0x388ccfdd, 0x30e3}, // yasmallkatakana {0x3896be1c, 0x0025}, // percent {0x38a80af1, 0x306d}, // nehiragana @@ -1002,7 +920,6 @@ static struct Hash2Unicode { {0x38de4662, 0x1e7c}, // Vtilde {0x38e73ed2, 0x01c0}, // clickdental {0x38efc9e4, 0x04a6}, // Pemiddlehookcyrillic - {0x391bc4d9, 0xf6d3}, // dblGrave {0x391e728b, 0x099a}, // cabengali {0x392c00af, 0x3305}, // intisquare {0x3934b5de, 0x0e43}, // saraaimaimuanthai @@ -1056,7 +973,6 @@ static struct Hash2Unicode { {0x3c89c6b7, 0x2192}, // arrowright {0x3c9425ca, 0x0666}, // sixhackarabic {0x3c9b6897, 0xff0e}, // periodmonospace - {0x3c9bce6c, 0xf7ee}, // Icircumflexsmall {0x3ca31461, 0x01d1}, // Ocaron {0x3ca4227b, 0x0120}, // Gdot {0x3ca9c5ab, 0x0345}, // ypogegrammenigreekcmb @@ -1076,7 +992,6 @@ static struct Hash2Unicode { {0x3d4a2f11, 0x0187}, // Chook {0x3d50ceda, 0x21a8}, // arrowupdnbse {0x3d59a63c, 0x30e2}, // mokatakana - {0x3d64f67d, 0xf6cd}, // DieresisGrave {0x3d6d45f8, 0x0688}, // ddalarabic {0x3d794ead, 0x04c8}, // enhookcyrillic {0x3d888246, 0x300d}, // cornerbracketright @@ -1087,13 +1002,10 @@ static struct Hash2Unicode { {0x3da45134, 0xff3d}, // bracketrightmonospace {0x3dac6cb7, 0x212e}, // estimated {0x3db24f7f, 0x04eb}, // obarreddieresiscyrillic - {0x3dc500c0, 0xf6ca}, // Caron {0x3ddbfa17, 0xfe64}, // lesssmall - {0x3de34107, 0xf6d2}, // cyrFlex {0x3de84dee, 0x3387}, // GBsquare {0x3de8cd4d, 0x02c9}, // firsttonechinese {0x3deb36dc, 0x0570}, // hoarmenian - {0x3dee4810, 0xf7a2}, // centoldstyle {0x3e08b864, 0x1e1c}, // Ecedillabreve {0x3e2966c3, 0x25a7}, // squareupperlefttolowerrightfill {0x3e2ad069, 0x0125}, // hcircumflex @@ -1105,27 +1017,20 @@ static struct Hash2Unicode { {0x3e7bef16, 0x063a}, // ghainarabic {0x3e9c0cab, 0x0e0d}, // yoyingthai {0x3ea9e6c5, 0x044e}, // afii10096 - {0x3eb04aa9, 0xf7f2}, // Ogravesmall {0x3ec30c4d, 0x0168}, // Utilde - {0x3ed009a2, 0x05e8}, // reshhiriq {0x3ed6d505, 0x3108}, // fbopomofo {0x3edc9801, 0x031e}, // downtackbelowcmb {0x3edf2653, 0x04ba}, // Shhacyrillic {0x3edfbd48, 0x0959}, // khhadeva {0x3ee5a28f, 0x0342}, // perispomenigreekcmb - {0x3ef03dd0, 0xf7e5}, // Aringsmall {0x3ef2c5ca, 0x05df}, // finalnunhebrew - {0x3efcba10, 0x05d3}, // daletpatahhebrew {0x3efcef55, 0x09a7}, // dhabengali {0x3f19d4d4, 0x30e5}, // yusmallkatakana {0x3f35ecb4, 0x0a0f}, // eegurmukhi {0x3f36dce9, 0x061b}, // afii57403 - {0x3f3b739c, 0x05e7}, // qofpatahhebrew - {0x3f4e4960, 0xf76a}, // Jsmall {0x3f5ead94, 0x0456}, // icyrillic {0x3f61f37a, 0x1ea3}, // ahookabove {0x3f76f3d1, 0x0214}, // Udblgrave - {0x3f77d74f, 0x05e8}, // reshqubuts {0x3f817391, 0x314b}, // khieukhkorean {0x3f8b0c34, 0x30c7}, // dekatakana {0x3fa4349b, 0x0e1d}, // fofathai @@ -1136,7 +1041,6 @@ static struct Hash2Unicode { {0x3fe534eb, 0x0e12}, // thophuthaothai {0x4016947c, 0x246b}, // twelvecircle {0x401a74d3, 0x06f3}, // threepersian - {0x402ddc95, 0xed1a}, // bracehtipupright {0x40663d0c, 0xfeb2}, // seenfinalarabic {0x4069b3b1, 0x24ab}, // pparen {0x407a7b83, 0x0531}, // Aybarmenian @@ -1227,7 +1131,6 @@ static struct Hash2Unicode { {0x44a78c72, 0x1eef}, // uhorntilde {0x44b414b4, 0xff0c}, // commamonospace {0x44d687fa, 0x1e06}, // Blinebelow - {0x450fad6c, 0xf6fd}, // Scaronsmall {0x45116064, 0x2592}, // shade {0x453aa0af, 0x09f0}, // ramiddlediagonalbengali {0x4546a724, 0x05d0}, // afii57664 @@ -1251,10 +1154,8 @@ static struct Hash2Unicode { {0x4611c6d0, 0x000b}, // controlVT {0x461bc854, 0x0194}, // Gammaafrican {0x46271982, 0x23ac}, // bracerightmid - {0x46375ba2, 0x23d0}, // arrowvertex {0x4652be4f, 0x1e6d}, // tdotbelow {0x46541398, 0x0111}, // dmacron - {0x46577172, 0x22c3}, // uniondisplay {0x465ea2f8, 0x3202}, // tikeutparenkorean {0x46611d40, 0x05bb}, // qubuts31 {0x466452b7, 0x321b}, // hieuhaparenkorean @@ -1273,15 +1174,12 @@ static struct Hash2Unicode { {0x470d662e, 0x042e}, // IUcyrillic {0x470da4b8, 0x0453}, // gjecyrillic {0x471d219d, 0x00f4}, // ocircumflex - {0x47246853, 0xf890}, // maitriupperleftthai {0x472c971d, 0x1e4d}, // otildeacute {0x47542f2d, 0x0107}, // cacute {0x47849b51, 0x05e5}, // finaltsadi {0x478eb915, 0x014f}, // obreve - {0x47a8409c, 0x05e8}, // reshqubutshebrew {0x47b12f1d, 0x3009}, // anglebracketright {0x47b78334, 0x09a5}, // thabengali - {0x47dfd2f2, 0xf7a1}, // exclamdownsmall {0x47ee62a0, 0x04f1}, // udieresiscyrillic {0x480265ce, 0x06f2}, // twopersian {0x48175191, 0x0130}, // Idotaccent @@ -1298,7 +1196,6 @@ static struct Hash2Unicode { {0x48b11825, 0x1e3f}, // macute {0x48b31eb3, 0x02a3}, // dzaltone {0x48bbab6b, 0x1e68}, // Sdotbelowdotaccent - {0x48cf810a, 0x27e8}, // angbracketleftBigg {0x48d0cd97, 0x0460}, // Omegacyrillic {0x48ed1289, 0x3180}, // ssangieungkorean {0x48f1ea86, 0x007c}, // verticalbar @@ -1316,27 +1213,22 @@ static struct Hash2Unicode { {0x49c941c8, 0x0630}, // thalarabic {0x49cf949f, 0x0011}, // controlDC1 {0x49d53679, 0x053e}, // Caarmenian - {0x49de9093, 0x0029}, // parenrightBig {0x49e41b40, 0x0117}, // edotaccent {0x4a059748, 0x2329}, // angleleft {0x4a0a939e, 0x02dc}, // ilde {0x4a0dc7cd, 0x0273}, // nhookretroflex {0x4a1b8688, 0x0a8f}, // egujarati - {0x4a26a1e2, 0xf88c}, // maieklowleftthai {0x4a67a4cd, 0x33c6}, // coverkgsquare {0x4a6dc3e0, 0x017c}, // zdotaccent {0x4a8f25d9, 0x0134}, // Jcircumflex {0x4a911686, 0x042a}, // Hardsigncyrillic {0x4aa9a643, 0x220c}, // notcontains - {0x4ab184ff, 0x221a}, // radicalbt {0x4ab871b2, 0x05a9}, // telishaqetanahebrew {0x4ad4b644, 0x066c}, // thousandsseparatorpersian - {0x4ad593e8, 0x05e7}, // qofpatah {0x4adaae02, 0x30bc}, // zekatakana {0x4b13bfc7, 0x261f}, // pointingindexdownwhite {0x4b146e46, 0x0076}, // v {0x4b1cfc1b, 0x0052}, // R - {0x4b214add, 0x05e8}, // reshhatafsegolhebrew {0x4b69c8eb, 0x3200}, // kiyeokparenkorean {0x4b7a4380, 0x326b}, // thieuthcirclekorean {0x4b8cb1d3, 0x315a}, // oekorean @@ -1355,7 +1247,6 @@ static struct Hash2Unicode { {0x4ca2293a, 0x0549}, // Chaarmenian {0x4ca721bb, 0x24d9}, // jcircle {0x4cbb6976, 0x054c}, // Raarmenian - {0x4cbfbcf5, 0xf6cb}, // Dieresis {0x4cc2766b, 0x0474}, // Izhitsacyrillic {0x4ccaa98f, 0x0292}, // ezh {0x4cda32dd, 0x2592}, // shademedium @@ -1367,12 +1258,10 @@ static struct Hash2Unicode { {0x4d66ad61, 0x0259}, // schwa {0x4d6f0f44, 0x03b6}, // zeta {0x4d76cbca, 0x0939}, // hadeva - {0x4d773822, 0x007d}, // bracerightbig {0x4da2ea17, 0x30f7}, // vakatakana {0x4dad3b1f, 0xff47}, // gmonospace {0x4db4092d, 0x05b2}, // hatafpatahquarterhebrew {0x4dc635ef, 0x03c2}, // sigmafinal - {0x4dccadbd, 0xf6ea}, // bsuperior {0x4dd49001, 0x04ae}, // Ustraightcyrillic {0x4dd4e51e, 0x05e3}, // finalpe {0x4ddb0ff8, 0x3014}, // tortoiseshellbracketleft @@ -1407,15 +1296,12 @@ static struct Hash2Unicode { {0x4fb92256, 0x216b}, // Twelveroman {0x4fdd1a2b, 0x300a}, // dblanglebracketleft {0x4feaecfe, 0x22c3}, // uniontext - {0x4fef28fa, 0xf6c3}, // commaaccent {0x5004c9ab, 0x09ed}, // sevenbengali {0x50166be8, 0x049a}, // Kadescendercyrillic {0x501dd48e, 0x2229}, // intersection {0x5024fa7b, 0x260f}, // whitetelephone - {0x5026482c, 0x228f}, // a60 {0x502bdceb, 0x3290}, // ideographsuncircle {0x503133b5, 0x0009}, // controlHT - {0x50604a35, 0x05e7}, // qofqubuts {0x507713d7, 0x2a02}, // circlemultiplytext {0x50794cf3, 0x255d}, // SF260000 {0x508090a0, 0xff82}, // tukatakanahalfwidth @@ -1434,7 +1320,6 @@ static struct Hash2Unicode { {0x51439af3, 0x064e}, // afii57454 {0x5147986a, 0xff5b}, // braceleftmonospace {0x514d7298, 0x3238}, // ideographiclaborparen - {0x5153d63f, 0xf895}, // maichattawalowleftthai {0x515692ea, 0x0414}, // Decyrillic {0x51616742, 0x328c}, // ideographwatercircle {0x51817d65, 0xfca1}, // tehjeeminitialarabic @@ -1442,7 +1327,6 @@ static struct Hash2Unicode { {0x51ca7ab6, 0x00f6}, // odieresis {0x51cbc424, 0x014d}, // omacron {0x51d34569, 0x00e9}, // eacute - {0x51e4f41a, 0xf6db}, // trademarkserif {0x51e6847c, 0x05b2}, // hatafpatah16 {0x51ed3cb2, 0x00af}, // macron {0x51f006ea, 0x24af}, // tparen @@ -1465,16 +1349,12 @@ static struct Hash2Unicode { {0x532f469f, 0x093d}, // avagrahadeva {0x533e9388, 0x02bc}, // afii57929 {0x537b0d36, 0x0466}, // Yuslittlecyrillic - {0x5382e913, 0x002f}, // slashBigg - {0x5396a4ab, 0x2a04}, // unionmultidisplay {0x53b3b784, 0xfb4a}, // tavdagesh {0x53ca8524, 0x099d}, // jhabengali - {0x53d60270, 0x05d3}, // dalethiriqhebrew {0x53d8dfb9, 0x3115}, // shbopomofo {0x53e66e1a, 0x0476}, // Izhitsadblgravecyrillic {0x53f49c2a, 0x066c}, // thousandsseparatorarabic {0x53f951b5, 0x056f}, // kenarmenian - {0x53febc17, 0x05e8}, // reshqamatshebrew {0x540493c8, 0x03b1}, // alpha {0x540c5f40, 0x0552}, // Yiwnarmenian {0x542576f9, 0x0a07}, // igurmukhi @@ -1484,17 +1364,13 @@ static struct Hash2Unicode { {0x548a6dde, 0x0451}, // iocyrillic {0x5494ff15, 0x053c}, // Liwnarmenian {0x54cc0e6b, 0x0212}, // Rinvertedbreve - {0x54d729fd, 0xf6bf}, // LL {0x54dfda54, 0xfe44}, // whitecornerbracketrightvertical {0x54f8c0f2, 0x1e78}, // Utildeacute {0x55003750, 0x05b0}, // shevanarrowhebrew {0x55021a5a, 0x0644}, // lamarabic - {0x5509dd21, 0xf7bf}, // questiondownsmall {0x550a9f23, 0x0452}, // djecyrillic {0x550d7456, 0x0061}, // a {0x5512ec97, 0x0067}, // g - {0x55164cbd, 0xf7fb}, // Ucircumflexsmall - {0x552705b9, 0xf7e1}, // Aacutesmall {0x552e72ea, 0x1e8d}, // xdieresis {0x5532b75e, 0x3044}, // ihiragana {0x554f67fa, 0x1e4e}, // Otildedieresis @@ -1504,9 +1380,8 @@ static struct Hash2Unicode { {0x558d2385, 0x0318}, // lefttackbelowcmb {0x55aa99d5, 0xfe3f}, // anglebracketleftvertical {0x55b44317, 0x1ef2}, // Ygrave - {0x55b8ceec, 0xed6b}, // radicalvertex {0x55c6e8cd, 0x0aac}, // bagujarati - {0x55e74cbe, 0xf8fb}, // bracketrightbt + {0x55e74cbe, 0x23a6}, // bracketrightbt {0x55e81ebb, 0x3124}, // angbopomofo {0x56000715, 0x33b0}, // pssquare {0x560f90ad, 0x25e4}, // blackupperlefttriangle @@ -1515,24 +1390,19 @@ static struct Hash2Unicode { {0x56362764, 0x24d0}, // acircle {0x565aa859, 0x30a8}, // ekatakana {0x565d95fc, 0x3109}, // dbopomofo - {0x566af414, 0xed6a}, // radicaltp - {0x567e8709, 0xf6f4}, // Brevesmall - {0x569f0bdc, 0x05e7}, // qofqamats {0x56a0101f, 0x04ac}, // Tedescendercyrillic {0x56d036b9, 0x000f}, // controlSI {0x56deae12, 0x0102}, // Abreve {0x57050efe, 0x0145}, // Ncommaaccent {0x5708e98e, 0x3154}, // ekorean - {0x570da3d3, 0xf8e9}, // copyrightsans {0x5713d355, 0x2790}, // sevencircleinversesansserif - {0x575226bc, 0xf8f7}, // parenrightex + {0x575226bc, 0x239f}, // parenrightex {0x57687403, 0x0e08}, // chochanthai {0x576959da, 0x04b7}, // chedescendercyrillic {0x577fdcc5, 0x033a}, // bridgeinvertedbelowcmb {0x578594f4, 0x0e47}, // maitaikhuthai {0x579e8de2, 0x2074}, // foursuperior {0x57a10bfe, 0x0435}, // iecyrillic - {0x57a26403, 0xf6eb}, // dsuperior {0x57c4d153, 0xfb1f}, // yodyodpatahhebrew {0x57c8c90f, 0x313b}, // rieulmieumkorean {0x57cea503, 0xff17}, // sevenmonospace @@ -1550,14 +1420,12 @@ static struct Hash2Unicode { {0x587d22eb, 0x208d}, // parenleftinferior {0x58a61c85, 0x1e9a}, // arighthalfring {0x58ab0a67, 0x0544}, // Menarmenian - {0x58ae8d36, 0x05e8}, // reshhatafpatah {0x58ba15a9, 0x24c9}, // Tcircle {0x58c52193, 0x221a}, // radical {0x58df0572, 0x0301}, // acutecmb {0x58dfd388, 0x3187}, // yoyakorean {0x58e61a1f, 0x05e8}, // resh {0x58ea1dd9, 0x0650}, // afii57456 - {0x59322213, 0xf7e8}, // Egravesmall {0x593b3f38, 0x0aa1}, // ddagujarati {0x5951351c, 0x0109}, // ccircumflex {0x59664498, 0xff21}, // Amonospace @@ -1581,7 +1449,6 @@ static struct Hash2Unicode { {0x5a8d2a4a, 0x09c3}, // rvocalicvowelsignbengali {0x5a963c7c, 0x0e02}, // khokhaithai {0x5acd345c, 0x339c}, // squaremm - {0x5ad6e1c9, 0x05e7}, // qofsegol {0x5af634c5, 0x059e}, // gershayimaccenthebrew {0x5b041347, 0x0581}, // coarmenian {0x5b0fd985, 0x0360}, // tildedoublecmb @@ -1593,7 +1460,6 @@ static struct Hash2Unicode { {0x5b46f9e7, 0x2080}, // zeroinferior {0x5b54a5c3, 0x05e1}, // afii57681 {0x5b5f52e7, 0x0421}, // afii10035 - {0x5b68b5ed, 0xf892}, // maitrilowleftthai {0x5b6ab184, 0x25ef}, // largecircle {0x5b6f6c30, 0x0003}, // controlETX {0x5b720455, 0x014c}, // Omacron @@ -1616,11 +1482,9 @@ static struct Hash2Unicode { {0x5c4a060e, 0x0e29}, // sorusithai {0x5c6b0ced, 0x05b8}, // qamats33 {0x5c71c76c, 0x24b8}, // Ccircle - {0x5c738b36, 0xf776}, // Vsmall {0x5c7f4966, 0x01b8}, // Ezhreversed {0x5c97be88, 0x0a2a}, // pagurmukhi {0x5c9a7487, 0x30ec}, // rekatakana - {0x5c9f86aa, 0x05e8}, // reshshevahebrew {0x5ca0edc2, 0x01e7}, // gcaron {0x5cad2e17, 0x0679}, // tteharabic {0x5cb64e9e, 0x0150}, // Ohungarumlaut @@ -1639,7 +1503,6 @@ static struct Hash2Unicode { {0x5d32256c, 0x25c6}, // blackdiamond {0x5d333915, 0x2234}, // therefore {0x5d42ce05, 0x30c2}, // dikatakana - {0x5d4fa82e, 0xf724}, // dollaroldstyle {0x5d590cb1, 0x05bb}, // qubutsnarrowhebrew {0x5d71a05b, 0x0017}, // controlETB {0x5d85b369, 0x05b8}, // qamats29 @@ -1648,7 +1511,6 @@ static struct Hash2Unicode { {0x5dba07ed, 0x22a5}, // perpendicular {0x5dbeec87, 0x01cd}, // Acaron {0x5de3b63c, 0x09cb}, // ovowelsignbengali - {0x5df717ca, 0x05e8}, // reshtserehebrew {0x5e0aac56, 0x0200}, // Adblgrave {0x5e1c8dfa, 0x05b0}, // sheva2e {0x5e27fa57, 0xff6d}, // yusmallkatakanahalfwidth @@ -1666,7 +1528,6 @@ static struct Hash2Unicode { {0x5f4a5f07, 0x0abe}, // aavowelsigngujarati {0x5f5c5d5f, 0x041b}, // Elcyrillic {0x5f63748c, 0x03e6}, // Kheicoptic - {0x5f6ca553, 0x230a}, // floorleftbigg {0x5f7dc76d, 0x033b}, // squarebelowcmb {0x5f881d5c, 0x3160}, // yukorean {0x5f8f63e2, 0x24a0}, // eparen @@ -1674,7 +1535,6 @@ static struct Hash2Unicode { {0x5fa5f5cc, 0xfefa}, // lamalefhamzabelowfinalarabic {0x5fb56903, 0x095d}, // rhadeva {0x5fbeac33, 0x028b}, // vhook - {0x5fd46519, 0xf6ef}, // msuperior {0x5fe9065e, 0x042e}, // afii10048 {0x6037ae88, 0x1ef3}, // ygrave {0x603b5882, 0x2287}, // reflexsuperset @@ -1699,7 +1559,6 @@ static struct Hash2Unicode { {0x61503571, 0x027b}, // rhookturned {0x6154bc05, 0x043b}, // afii10077 {0x617c687c, 0x01a2}, // Oi - {0x618467d6, 0xf7f3}, // Oacutesmall {0x6198a771, 0xfef3}, // alefmaksurainitialarabic {0x61a21109, 0x01c9}, // lj {0x61a2d0df, 0x258c}, // lfblock @@ -1714,14 +1573,12 @@ static struct Hash2Unicode { {0x61f36361, 0x06f8}, // eightpersian {0x61fe712f, 0x20a4}, // afii08941 {0x621057dd, 0x1ef5}, // ydotbelow - {0x62106755, 0xf6e5}, // hypheninferior {0x62127977, 0x266a}, // musicalnote {0x62161c15, 0x05da}, // finalkafhebrew {0x6229838d, 0x05d0}, // alef {0x62447ae3, 0x0314}, // commareversedabovecmb {0x6248b5e6, 0x33dd}, // wbsquare {0x625320aa, 0x30b2}, // gekatakana - {0x6259e0bf, 0xf6f1}, // rsuperior {0x6260c6fc, 0x0589}, // periodarmenian {0x6265e881, 0x2266}, // lessoverequal {0x626cbaa4, 0x01bf}, // wynn @@ -1729,7 +1586,7 @@ static struct Hash2Unicode { {0x62896f4a, 0x05f2}, // yodyodhebrew {0x628a5951, 0xff56}, // vmonospace {0x62a11b25, 0x1e87}, // wdotaccent - {0x62accaf5, 0xf8ed}, // parenleftbt + {0x62accaf5, 0x239d}, // parenleftbt {0x62b2cd2d, 0x00c2}, // Acircumflex {0x62b6e7ac, 0x01a5}, // phook {0x62c361d5, 0x05e2}, // afii57682 @@ -1750,7 +1607,6 @@ static struct Hash2Unicode { {0x637d3539, 0x00bc}, // onequarter {0x6389d9bb, 0x0641}, // afii57441 {0x63a82931, 0x0297}, // cstretched - {0x63ab7e3b, 0xf6dd}, // rupiah {0x63d84bb6, 0x2281}, // notsucceeds {0x63dfed74, 0x311f}, // eibopomofo {0x63e274d2, 0xfc0b}, // tehjeemisolatedarabic @@ -1762,12 +1618,9 @@ static struct Hash2Unicode { {0x64468e36, 0x0e18}, // thothongthai {0x64517fe8, 0x004b}, // K {0x6453c78e, 0x064e}, // fathalowarabic - {0x6454154f, 0xf6ec}, // esuperior {0x6460d798, 0x3025}, // fivehangzhou - {0x64699e37, 0x2309}, // ceilingrightBigg {0x646b157e, 0x3242}, // ideographicselfparen {0x646c5c19, 0x0ab5}, // vagujarati - {0x64755597, 0x05e7}, // qofholamhebrew {0x647eca4f, 0x09ae}, // mabengali {0x64a1b76b, 0x30fa}, // vokatakana {0x64d00b32, 0x0114}, // Ebreve @@ -1784,13 +1637,12 @@ static struct Hash2Unicode { {0x6543f12c, 0x01d5}, // Udieresismacron {0x654d08a0, 0x0e3a}, // phinthuthai {0x657ffabd, 0x22ee}, // ellipsisvertical - {0x6594aba1, 0x02c3}, // a41 {0x6598fbfe, 0x3112}, // xbopomofo {0x65a5bd1b, 0x24e1}, // rcircle {0x65be15d1, 0x0a08}, // iigurmukhi {0x65c095c5, 0x200e}, // afii299 {0x65cc1f56, 0x0545}, // Yiarmenian - {0x662a6586, 0xf8f8}, // parenrightbt + {0x662a6586, 0x23a0}, // parenrightbt {0x662a831c, 0x1eeb}, // uhorngrave {0x663a2c1a, 0x3300}, // apaatosquare {0x6642f834, 0x0361}, // breveinverteddoublecmb @@ -1801,11 +1653,8 @@ static struct Hash2Unicode { {0x666faf51, 0xfba5}, // hehhamzaabovefinalarabic {0x6689dbc7, 0x33cb}, // HPsquare {0x668e9764, 0x30a2}, // akatakana - {0x669881eb, 0xf8e5}, // radicalex - {0x66b92e17, 0x05e8}, // reshholam {0x66bb979c, 0x246c}, // thirteencircle {0x66c590a5, 0x2236}, // ratio - {0x66e750ef, 0xf7ec}, // Igravesmall {0x66e9c5c7, 0x3084}, // yahiragana {0x66ef8fdf, 0x040f}, // afii10145 {0x66fb9b49, 0x33c9}, // gysquare @@ -1819,7 +1668,6 @@ static struct Hash2Unicode { {0x6776a85a, 0x0ac7}, // evowelsigngujarati {0x6779be95, 0x3113}, // zhbopomofo {0x6785194b, 0x221f}, // rightangle - {0x67949ab4, 0xf891}, // maitrilowrightthai {0x679d9205, 0x02c5}, // arrowheaddownmod {0x679dcadd, 0x0e54}, // fourthai {0x679ffc49, 0x2024}, // onedotenleader @@ -1834,13 +1682,10 @@ static struct Hash2Unicode { {0x6811e3e1, 0x0404}, // Ecyrillic {0x6814026d, 0x02c8}, // verticallinemod {0x682b08dd, 0x01ac}, // Thook - {0x683090d6, 0xf6f0}, // osuperior {0x6853e235, 0x0652}, // sukunarabic {0x685932be, 0xfe36}, // parenrightvertical - {0x68744fba, 0x220f}, // producttext {0x68a76955, 0x00c7}, // Ccedilla {0x68b3215e, 0x0339}, // ringhalfrightbelowcmb - {0x68b3ae0f, 0x222e}, // contintegraldisplay {0x68b98a65, 0x0679}, // afii57511 {0x68ccd1d8, 0x3212}, // mieumaparenkorean {0x68eb418e, 0x3011}, // blacklenticularbracketright @@ -1877,14 +1722,11 @@ static struct Hash2Unicode { {0x6b83db74, 0x2295}, // circleplus {0x6b85cd6e, 0x00a4}, // currency {0x6b8b924f, 0x30d8}, // hekatakana - {0x6b8f0a54, 0xf6df}, // centinferior {0x6b908b1b, 0x09e7}, // onebengali {0x6b98f18c, 0x212b}, // angstrom {0x6b9adcc4, 0x25cf}, // blackcircle {0x6b9f4fbe, 0x0940}, // iivowelsigndeva - {0x6ba8c1e2, 0xf6ce}, // Grave {0x6baa5ba4, 0x03ce}, // omegatonos - {0x6bb62dc9, 0xf77a}, // Zsmall {0x6bbd76c8, 0x0936}, // shadeva {0x6bca6ff5, 0xfe4a}, // overlinecenterline {0x6bd59d12, 0x0915}, // kadeva @@ -1892,10 +1734,8 @@ static struct Hash2Unicode { {0x6be13af7, 0x2199}, // arrowdownleft {0x6bf10a81, 0x2015}, // horizontalbar {0x6c0e37b1, 0x30ce}, // nokatakana - {0x6c0f6861, 0x05e7}, // qofhatafsegolhebrew {0x6c11086e, 0x0a1c}, // jagurmukhi {0x6c180b9f, 0x0462}, // Yatcyrillic - {0x6c23928a, 0x222e}, // contintegraltext {0x6c429460, 0xfb40}, // nundageshhebrew {0x6c5c9da6, 0x0457}, // yicyrillic {0x6c781e8a, 0x25bd}, // whitedownpointingtriangle @@ -1908,7 +1748,6 @@ static struct Hash2Unicode { {0x6d02864a, 0x049c}, // Kaverticalstrokecyrillic {0x6d1b554b, 0x0982}, // anusvarabengali {0x6d3fc0d7, 0x040f}, // Dzhecyrillic - {0x6d4379b8, 0x220f}, // productdisplay {0x6d519305, 0x2169}, // Tenroman {0x6d63a915, 0x02bc}, // apostrophemod {0x6d6c6ece, 0x307f}, // mihiragana @@ -1955,10 +1794,7 @@ static struct Hash2Unicode { {0x6fae2151, 0x0aef}, // ninegujarati {0x6fbeef2a, 0x044d}, // ereversedcyrillic {0x6fc01d9f, 0x00f8}, // oslash - {0x6fdfa2dc, 0xf6e7}, // periodinferior - {0x70068cb8, 0xf7ea}, // Ecircumflexsmall {0x702ecc19, 0x3054}, // gohiragana - {0x70300d95, 0xf761}, // Asmall {0x70534c83, 0x05a4}, // mahapakhlefthebrew {0x7061d5ad, 0x255a}, // SF380000 {0x707057b4, 0xfb2e}, // alefpatahhebrew @@ -1966,7 +1802,6 @@ static struct Hash2Unicode { {0x7077f8df, 0x0163}, // tcommaaccent {0x708cf64a, 0x0944}, // rrvocalicvowelsigndeva {0x709b2bbe, 0x0056}, // V - {0x709b801f, 0x05da}, // finalkafshevahebrew {0x70a0d365, 0xfeee}, // wawfinalarabic {0x70a7b34b, 0x05b5}, // tsere12 {0x70c1bcae, 0x1ede}, // Ohornhookabove @@ -2001,7 +1836,6 @@ static struct Hash2Unicode { {0x7278753d, 0x04d7}, // iebrevecyrillic {0x728cf068, 0x020f}, // oinvertedbreve {0x728f761b, 0x3111}, // qbopomofo - {0x72ad941b, 0xf733}, // threeoldstyle {0x72b3c6a8, 0x00b4}, // acute {0x72ba7ff6, 0x3093}, // nhiragana {0x72c6f1c4, 0xff5c}, // barmonospace @@ -2011,8 +1845,6 @@ static struct Hash2Unicode { {0x72fc7974, 0x2111}, // Ifraktur {0x72fd959a, 0x002a}, // asterisk {0x73032cb1, 0x3268}, // cieuccirclekorean - {0x731486cf, 0xf6e1}, // commainferior - {0x731a7d35, 0xf6fb}, // Ogoneksmall {0x731be3b3, 0x3140}, // rieulhieuhkorean {0x73200dbd, 0x0e20}, // phosamphaothai {0x7322d42e, 0x24b9}, // Dcircle @@ -2028,10 +1860,7 @@ static struct Hash2Unicode { {0x73b2bbd4, 0xfe63}, // hyphensmall {0x73b70a88, 0x05d8}, // afii57672 {0x73b7c451, 0x095a}, // ghhadeva - {0x73c3073f, 0xf6ee}, // lsuperior {0x73c5e60b, 0x004e}, // N - {0x73e1033a, 0x22b4}, // a2 - {0x73e5498e, 0xf7fd}, // Yacutesmall {0x73ee6902, 0x0965}, // dbldanda {0x73f5578c, 0x093f}, // ivowelsigndeva {0x74030714, 0x311c}, // ebopomofo @@ -2055,12 +1884,10 @@ static struct Hash2Unicode { {0x74f1fca9, 0x01db}, // Udieresisgrave {0x7506e8c8, 0x24d1}, // bcircle {0x751253a5, 0x2168}, // Nineroman - {0x7542c0c4, 0xf8e8}, // registersans {0x7544678b, 0x307d}, // pohiragana {0x754982de, 0x06a4}, // veharabic {0x755a250b, 0x09dd}, // rhabengali {0x755f707c, 0x1ebf}, // ecircumflexacute - {0x75811646, 0xf6e9}, // asuperior {0x75841530, 0x2002}, // enspace {0x75907eb0, 0x322c}, // ideographicwaterparen {0x759ddc3d, 0x3068}, // tohiragana @@ -2088,7 +1915,6 @@ static struct Hash2Unicode { {0x76af2566, 0x05c1}, // afii57804 {0x76b279b9, 0x1e76}, // Ucircumflexbelow {0x76be5e67, 0x0389}, // Etatonos - {0x76e8986c, 0x27e9}, // angbracketrightBigg {0x76ec167e, 0x3128}, // ubopomofo {0x76ee8ef9, 0x326a}, // khieukhcirclekorean {0x76fa92ba, 0x2225}, // parallel @@ -2096,9 +1922,8 @@ static struct Hash2Unicode { {0x772d6b37, 0x3294}, // ideographnamecircle {0x774eb078, 0x0328}, // ogonekcmb {0x774fe771, 0x064d}, // kasratanarabic - {0x7752bcc4, 0xf8f6}, // parenrighttp + {0x7752bcc4, 0x239e}, // parenrighttp {0x775a46a9, 0xffe0}, // centmonospace - {0x77617e4f, 0xf762}, // Bsmall {0x77651620, 0x007b}, // braceleft {0x776629fd, 0x044a}, // hardsigncyrillic {0x7766a0eb, 0x041e}, // Ocyrillic @@ -2115,7 +1940,6 @@ static struct Hash2Unicode { {0x77ee824a, 0xfba7}, // hehfinalaltonearabic {0x77f415ae, 0x03eb}, // gangiacoptic {0x77f608a5, 0x00ec}, // igrave - {0x78075c57, 0x007d}, // bracerightBig {0x78151b28, 0x04f8}, // Yerudieresiscyrillic {0x781b1710, 0x3175}, // pieupsiostikeutkorean {0x782f5323, 0x2297}, // circlemultiply @@ -2128,7 +1952,6 @@ static struct Hash2Unicode { {0x7878b2f0, 0x323c}, // ideographicsuperviseparen {0x788e7d3e, 0x05b3}, // hatafqamats {0x78965447, 0x0593}, // shalshelethebrew - {0x78a67a97, 0xf8ea}, // trademarksans {0x78d4db12, 0x032e}, // brevebelowcmb {0x78da6d23, 0x046e}, // Ksicyrillic {0x78f4df25, 0x04d9}, // schwacyrillic @@ -2168,11 +1991,9 @@ static struct Hash2Unicode { {0x7ad78099, 0x05b5}, // afii57794 {0x7b074f4f, 0x062c}, // jeemarabic {0x7b0aca00, 0x3315}, // kiroguramusquare - {0x7b3db32a, 0x221a}, // radicalBig {0x7b443626, 0x3331}, // birusquare {0x7b5e0418, 0xff10}, // zeromonospace {0x7b7b9d4d, 0x0424}, // afii10038 - {0x7b7fbb65, 0xf7b8}, // Cedillasmall {0x7b80aee5, 0x05bb}, // qubutsquarterhebrew {0x7b8c3862, 0x02b8}, // ysuperior {0x7bac8f33, 0x0016}, // controlSYN @@ -2180,8 +2001,6 @@ static struct Hash2Unicode { {0x7bd5ca88, 0x33ca}, // hasquare {0x7bd8b82b, 0x3005}, // ideographiciterationmark {0x7c301325, 0x0472}, // Fitacyrillic - {0x7c35d223, 0x05dc}, // lamedholam - {0x7c3e1570, 0x0028}, // parenleftbigg {0x7c3f4566, 0x00e7}, // ccedilla {0x7c4777ca, 0xfcc9}, // lamjeeminitialarabic {0x7c4f7ece, 0x0ab2}, // lagujarati @@ -2195,7 +2014,6 @@ static struct Hash2Unicode { {0x7cf2e5f4, 0x0029}, // parenright {0x7cf2ebbd, 0xff96}, // yokatakanahalfwidth {0x7cf8ce2e, 0x3394}, // thzsquare - {0x7d1ff070, 0xf896}, // thanthakhatupperleftthai {0x7d32ca29, 0x0127}, // hbar {0x7d44a576, 0x24b1}, // vparen {0x7d4ddd33, 0x2554}, // SF390000 @@ -2213,15 +2031,10 @@ static struct Hash2Unicode { {0x7e46df3d, 0x30d7}, // pukatakana {0x7e4f805e, 0x3067}, // dehiragana {0x7e5c9fda, 0x042f}, // IAcyrillic - {0x7e60a480, 0x0029}, // parenrightbigg {0x7e701b6d, 0xff0d}, // hyphenmonospace {0x7e739224, 0x3046}, // uhiragana - {0x7e7d09ba, 0xf6e4}, // dollarsuperior - {0x7e947543, 0xf773}, // Ssmall {0x7ebf5260, 0x0031}, // one {0x7eddac19, 0x09f4}, // onenumeratorbengali - {0x7eefb1cf, 0x05d3}, // daletshevahebrew - {0x7f0a4f83, 0x0631}, // rehyehaleflamarabic {0x7f43cdd7, 0x0ab0}, // ragujarati {0x7f56c599, 0x0141}, // Lslash {0x7f5b3579, 0x1e74}, // Utildebelow @@ -2232,7 +2045,6 @@ static struct Hash2Unicode { {0x7f92fe37, 0x066d}, // asteriskarabic {0x7f97f320, 0x301c}, // wavedash {0x7f99701f, 0xfb2a}, // shinshindothebrew - {0x7fad7e30, 0xf737}, // sevenoldstyle {0x7fbd4335, 0x2309}, // ceilingrightbig {0x7ff2087d, 0x01df}, // adieresismacron {0x7ffdad4c, 0x326e}, // kiyeokacirclekorean @@ -2242,12 +2054,10 @@ static struct Hash2Unicode { {0x8029e67d, 0x049b}, // kadescendercyrillic {0x803a882f, 0x0a8b}, // rvocalicgujarati {0x80417827, 0x33a9}, // pasquare - {0x80461d8b, 0xf6c7}, // afii10831 {0x8048e51c, 0x24e6}, // wcircle {0x80690312, 0x0155}, // racute {0x8076b638, 0xfedf}, // laminitialarabic {0x80792dfa, 0x0478}, // Ukcyrillic - {0x807bd424, 0xf886}, // saraiileftthai {0x8082c40e, 0x251c}, // SF080000 {0x8086d5c5, 0x0490}, // afii10050 {0x80890e42, 0x0316}, // gravebelowcmb @@ -2264,12 +2074,10 @@ static struct Hash2Unicode { {0x8140027d, 0x24d3}, // dcircle {0x815134d6, 0x00cd}, // Iacute {0x81589a47, 0x2220}, // angle - {0x816211ee, 0x05dc}, // lamedholamdageshhebrew {0x81658581, 0x0207}, // einvertedbreve {0x816871c9, 0x1ec2}, // Ecircumflexhookabove {0x8169da43, 0x0483}, // titlocyrilliccmb {0x8170d563, 0x256b}, // SF530000 - {0x81796466, 0xf6f2}, // ssuperior {0x817f112a, 0x1e37}, // ldotbelow {0x817f9471, 0x1e92}, // Zdotbelow {0x81806da2, 0x328d}, // ideographwoodcircle @@ -2306,8 +2114,6 @@ static struct Hash2Unicode { {0x832d9a03, 0x263b}, // invsmileface {0x83393d74, 0xfef7}, // lamalefhamzaaboveisolatedarabic {0x83589346, 0x1eb0}, // Abrevegrave - {0x836fd101, 0x25c7}, // a51 - {0x83736e7a, 0x2308}, // ceilingleftBig {0x837601e2, 0x0ae7}, // onegujarati {0x8377c3f2, 0x026b}, // lmiddletilde {0x837a2830, 0x2113}, // lsquare @@ -2344,17 +2150,14 @@ static struct Hash2Unicode { {0x84e0b580, 0x04ef}, // umacroncyrillic {0x8501599a, 0x30f6}, // kesmallkatakana {0x85103d59, 0xfb39}, // yoddagesh - {0x851a3968, 0xf6da}, // registerserif {0x853a4f53, 0x217b}, // twelveroman {0x855c805d, 0xff1a}, // colonmonospace {0x856013c8, 0x248a}, // threeperiod {0x8567c154, 0x01bc}, // Tonefive - {0x856bfeb5, 0x0029}, // parenrightBigg {0x85a6c8bc, 0x310a}, // tbopomofo {0x85b41716, 0x201a}, // quotesinglbase {0x85b6b018, 0x2228}, // logicalor {0x85c83eb6, 0xff77}, // kikatakanahalfwidth - {0x85cde6eb, 0xf8e7}, // arrowhorizex {0x85ce16f4, 0x05da}, // afii57674 {0x85e92466, 0x2282}, // propersubset {0x85ee23d7, 0x311b}, // obopomofo @@ -2364,7 +2167,6 @@ static struct Hash2Unicode { {0x86129c18, 0x2209}, // notelementof {0x861e8048, 0xff54}, // tmonospace {0x861ef200, 0x1e75}, // utildebelow - {0x864008ae, 0x05d3}, // daletqubutshebrew {0x8654695b, 0x0020}, // spacehackarabic {0x865c7659, 0x0312}, // commaturnedabovecmb {0x8665f7ab, 0x201b}, // quotereversed @@ -2416,12 +2218,10 @@ static struct Hash2Unicode { {0x88e4df33, 0x1e1b}, // etildebelow {0x88e6eee8, 0x3119}, // sbopomofo {0x88ea0124, 0x0949}, // ocandravowelsigndeva - {0x88ea9631, 0xf7af}, // Macronsmall {0x88f38eed, 0x21d0}, // arrowdblleft {0x88f62270, 0x314f}, // akorean {0x88fdc1bb, 0x308e}, // wasmallhiragana {0x88fdcf2e, 0x039e}, // Xi - {0x89098ea4, 0x2211}, // summationdisplay {0x893a8f13, 0x09b9}, // habengali {0x89468742, 0x0e1f}, // fofanthai {0x897340ea, 0x3207}, // ieungparenkorean @@ -2445,7 +2245,6 @@ static struct Hash2Unicode { {0x8ab11ede, 0x0907}, // ideva {0x8ab50af4, 0xfedb}, // kafinitialarabic {0x8ac9c3df, 0x00cb}, // Edieresis - {0x8ad52e55, 0x05d3}, // dalethatafsegolhebrew {0x8ae82e18, 0x05c2}, // sindothebrew {0x8aebef01, 0x064f}, // afii57455 {0x8af00e69, 0x3396}, // mlsquare @@ -2474,23 +2273,18 @@ static struct Hash2Unicode { {0x8c169f16, 0x0a4c}, // aumatragurmukhi {0x8c1a91ec, 0x1ed2}, // Ocircumflexgrave {0x8c21575a, 0x2175}, // sixroman - {0x8c31d770, 0x007d}, // bracerightBigg - {0x8c382c45, 0xf6c5}, // afii10064 {0x8c3dc32f, 0x0632}, // afii57426 {0x8c5fd3c7, 0x05dd}, // afii57677 - {0x8c6ceb51, 0xeb61}, // suppress {0x8c7614fd, 0x0046}, // F {0x8c789c98, 0x0255}, // ccurl {0x8c7eba77, 0x3114}, // chbopomofo {0x8c941f03, 0x0639}, // afii57433 {0x8c9c3f66, 0x0e37}, // saraueethai - {0x8c9d6579, 0x2308}, // ceilingleftBigg {0x8cb6cb59, 0xfb6c}, // vehinitialarabic {0x8cbe2a76, 0x0951}, // udattadeva {0x8cc838c1, 0x099f}, // ttabengali {0x8ccab94e, 0x311d}, // ehbopomofo {0x8cd2ceac, 0x322f}, // ideographicearthparen - {0x8cd87862, 0x2a01}, // circleplusdisplay {0x8cdd7a5e, 0xfefb}, // lamalefisolatedarabic {0x8cfeaaad, 0x04b4}, // Tetsecyrillic {0x8d0e3bcc, 0x0162}, // Tcommaaccent @@ -2506,7 +2300,6 @@ static struct Hash2Unicode { {0x8d5ae6d4, 0x0440}, // ercyrillic {0x8d62c566, 0x21e0}, // arrowdashleft {0x8d7f2614, 0x2164}, // Fiveroman - {0x8d983a6e, 0x22b5}, // a4 {0x8db3e76c, 0x1e97}, // tdieresis {0x8dbd6f57, 0xffe1}, // sterlingmonospace {0x8dc41abc, 0x1e33}, // kdotbelow @@ -2517,7 +2310,6 @@ static struct Hash2Unicode { {0x8e325301, 0x0133}, // ij {0x8e3386c6, 0x0439}, // iishortcyrillic {0x8e360b54, 0x027d}, // rhook - {0x8e38f2c0, 0x005d}, // bracketrightbig {0x8e40b292, 0x01fb}, // aringacute {0x8e467ab5, 0x1ecc}, // Odotbelow {0x8e474342, 0x1e2a}, // Hbrevebelow @@ -2529,7 +2321,6 @@ static struct Hash2Unicode { {0x8e7aa1b5, 0x207c}, // equalsuperior {0x8e8e0711, 0x042f}, // afii10049 {0x8e91af6c, 0x3000}, // ideographicspace - {0x8ec625f1, 0x2304}, // a43 {0x8ec9ea4f, 0xfb40}, // nundagesh {0x8eca9ee8, 0x045c}, // kjecyrillic {0x8ed1765d, 0xff36}, // Vmonospace @@ -2538,7 +2329,6 @@ static struct Hash2Unicode { {0x8f19bc84, 0x0e4a}, // maitrithai {0x8f289d06, 0x0444}, // efcyrillic {0x8f28eae1, 0x013f}, // Ldotaccent - {0x8f3d926c, 0xf7e2}, // Acircumflexsmall {0x8f4b9c51, 0x0404}, // afii10053 {0x8f505863, 0x04f2}, // Uhungarumlautcyrillic {0x8f52df2f, 0x0256}, // dtail @@ -2546,7 +2336,6 @@ static struct Hash2Unicode { {0x8f760fbe, 0x25e5}, // blackupperrighttriangle {0x8f7f3f67, 0x0645}, // afii57445 {0x8f89b56f, 0x05b8}, // qamatsqatanhebrew - {0x8f9b61ad, 0x22c0}, // logicalanddisplay {0x8fa69b6c, 0x0331}, // macronbelowcmb {0x8fbba331, 0x0205}, // edblgrave {0x8fc968d8, 0x01b9}, // ezhreversed @@ -2571,22 +2360,17 @@ static struct Hash2Unicode { {0x90b86ad8, 0x30dd}, // pokatakana {0x90b9c076, 0xff0f}, // slashmonospace {0x90c2be85, 0x0268}, // istroke - {0x90d8e15f, 0xf6e8}, // periodsuperior - {0x91032be8, 0x02c6}, // hatwide {0x910a1b16, 0x03f1}, // rhosymbolgreek - {0x91306ea5, 0x2127}, // a48 {0x9132f814, 0xff22}, // Bmonospace {0x9134ebbc, 0x01cb}, // Nj {0x913ff5ff, 0x3125}, // engbopomofo {0x9141d43c, 0x2126}, // Ohm - {0x914548fb, 0xf7f9}, // Ugravesmall {0x914ce494, 0x05e6}, // afii57686 {0x9166eec8, 0x33ba}, // pwsquare {0x916cdeb8, 0xfed2}, // fehfinalarabic {0x917f2f3f, 0x0438}, // afii10074 {0x9181b388, 0x01eb}, // oogonek {0x9184e24f, 0x30ab}, // kakatakana - {0x919c9ad4, 0xf898}, // thanthakhatlowleftthai {0x919f5679, 0x00ca}, // Ecircumflex {0x91acc220, 0xff91}, // mukatakanahalfwidth {0x91accd4b, 0x0937}, // ssadeva @@ -2594,9 +2378,7 @@ static struct Hash2Unicode { {0x91d99037, 0x1eb9}, // edotbelow {0x91de3939, 0x064f}, // dammalowarabic {0x91e65480, 0x0abf}, // ivowelsigngujarati - {0x91ea8b93, 0x2303}, // a42 {0x91eaac20, 0x3214}, // siosaparenkorean - {0x920233a7, 0xf6de}, // threequartersemdash {0x920dae79, 0x039f}, // Omicron {0x9215b042, 0x3147}, // ieungkorean {0x9220d7f0, 0xff69}, // usmallkatakanahalfwidth @@ -2606,7 +2388,6 @@ static struct Hash2Unicode { {0x926b691e, 0x0100}, // Amacron {0x92aa52d3, 0x30fb}, // dotkatakana {0x92e2ffd9, 0x21e8}, // arrowrightwhite - {0x92e50e35, 0xf88e}, // maitholowrightthai {0x92f283dc, 0x25d8}, // bulletinverse {0x92f96dbe, 0x1e56}, // Pdotaccent {0x930724f6, 0x06ba}, // noonghunnaarabic @@ -2634,9 +2415,7 @@ static struct Hash2Unicode { {0x94b7f6ea, 0x0463}, // yatcyrillic {0x94c36e74, 0x3261}, // nieuncirclekorean {0x94c9571f, 0x25ac}, // blackrectangle - {0x94ca16e5, 0xf893}, // maichattawaupperleftthai {0x94d13d1c, 0xfe39}, // tortoiseshellbracketleftvertical - {0x94d44c33, 0x007b}, // braceleftbig {0x94d74b96, 0x1e64}, // Sacutedotaccent {0x94e6f584, 0x3058}, // zihiragana {0x94ee5ae7, 0x2792}, // ninecircleinversesansserif @@ -2646,9 +2425,7 @@ static struct Hash2Unicode { {0x951ae869, 0x09dc}, // rrabengali {0x952cce64, 0x04ee}, // Umacroncyrillic {0x952ec009, 0x0988}, // iibengali - {0x95394a64, 0x05da}, // finalkafsheva {0x953a0a51, 0x2211}, // summation - {0x954920d5, 0xf769}, // Ismall {0x954a8776, 0x03d1}, // thetasymbolgreek {0x95526ac8, 0x2500}, // SF100000 {0x9559e176, 0x05b7}, // patah2a @@ -2671,7 +2448,6 @@ static struct Hash2Unicode { {0x9638605a, 0x0669}, // ninearabic {0x967b01ac, 0x05b9}, // holamhebrew {0x967d0326, 0x3134}, // nieunkorean - {0x968e4cb7, 0xf899}, // nikhahitleftthai {0x96a5e022, 0x25d9}, // invcircle {0x96b677d5, 0x0153}, // oe {0x96c05d98, 0x01f2}, // Dz @@ -2704,14 +2480,11 @@ static struct Hash2Unicode { {0x987e6d13, 0x0411}, // Becyrillic {0x9896e370, 0x0402}, // afii10051 {0x98b02dc0, 0x0a48}, // aimatragurmukhi - {0x98bf4a1b, 0xf6d0}, // Macron - {0x98c60f17, 0xf6d9}, // copyrightserif {0x98d74b1c, 0x01c8}, // Lj {0x98d9aba5, 0x03ae}, // etatonos {0x98eba766, 0x018b}, // Dtopbar {0x98f4783f, 0x24ac}, // qparen {0x98f4b751, 0x0651}, // afii57457 - {0x98ffb065, 0x02c6}, // hatwider {0x99104281, 0x02e5}, // tonebarextrahighmod {0x99235205, 0x05dc}, // lamedhebrew {0x994ebac3, 0x05c0}, // afii57842 @@ -2734,10 +2507,8 @@ static struct Hash2Unicode { {0x9a50ec2e, 0x05b6}, // segolquarterhebrew {0x9a7aab21, 0x05c3}, // sofpasuqhebrew {0x9ac6c137, 0x0e0f}, // topatakthai - {0x9ae2a69d, 0xf6c0}, // ll {0x9aea680b, 0x3029}, // ninehangzhou {0x9af6d63b, 0x054a}, // Peharmenian - {0x9b064cf1, 0xfedf}, // lammeemjeeminitialarabic {0x9b09b61d, 0x0a10}, // aigurmukhi {0x9b0db21d, 0x0402}, // Djecyrillic {0x9b100042, 0x0e21}, // momathai @@ -2755,7 +2526,6 @@ static struct Hash2Unicode { {0x9bcccde6, 0x0e4e}, // yamakkanthai {0x9bd59a36, 0x300e}, // whitecornerbracketleft {0x9bdb98a4, 0x1e5e}, // Rlinebelow - {0x9bdfdedf, 0x05d3}, // daletsheva {0x9be54046, 0x0e0a}, // chochangthai {0x9bfe067d, 0x0405}, // Dzecyrillic {0x9c14c866, 0x0484}, // palatalizationcyrilliccmb @@ -2793,8 +2563,6 @@ static struct Hash2Unicode { {0x9e1247f8, 0x0033}, // three {0x9e248728, 0x3053}, // kohiragana {0x9e2d5a68, 0x053f}, // Kenarmenian - {0x9e37413a, 0x22c2}, // intersectiondisplay - {0x9e4de0cc, 0x221a}, // radicalBigg {0x9e5de325, 0x222e}, // contourintegral {0x9e65e800, 0x248b}, // fourperiod {0x9e98d52c, 0x2483}, // sixteenparen @@ -2804,9 +2572,7 @@ static struct Hash2Unicode { {0x9eb5aea3, 0x3142}, // pieupkorean {0x9ebea1a0, 0x3150}, // aekorean {0x9ee7bbd1, 0x094b}, // ovowelsigndeva - {0x9eeac84b, 0xfee7}, // noonhehinitialarabic {0x9eedaba9, 0x0113}, // emacron - {0x9ef0c911, 0xf765}, // Esmall {0x9f023815, 0x20ac}, // euro {0x9f30fc87, 0xfec2}, // tahfinalarabic {0x9f37894c, 0x040e}, // afii10062 @@ -2816,11 +2582,9 @@ static struct Hash2Unicode { {0x9f6f9105, 0x0433}, // gecyrillic {0x9f739695, 0x04f9}, // yerudieresiscyrillic {0x9f79f6eb, 0xfb33}, // daletdageshhebrew - {0x9f7f5e1f, 0xf897}, // thanthakhatlowrightthai {0x9f8cff14, 0x003e}, // greater {0x9f94b2e4, 0x04a1}, // kabashkircyrillic {0x9fa5f7ad, 0x0e49}, // maithothai - {0x9fa872ec, 0x02dc}, // tildewidest {0x9fc7ffac, 0x05b4}, // hiriqhebrew {0x9fd406b1, 0xfed8}, // qafmedialarabic {0x9fd7c50e, 0x05bb}, // afii57796 @@ -2834,9 +2598,7 @@ static struct Hash2Unicode { {0xa05ccf71, 0x05e1}, // samekhhebrew {0xa069fd2d, 0x012b}, // imacron {0xa08ca5a7, 0x2491}, // tenperiod - {0xa09c7d02, 0x05e8}, // reshhatafpatahhebrew {0xa0a317f9, 0x0574}, // menarmenian - {0xa0adde45, 0xf884}, // maihanakatleftthai {0xa0c2ffe3, 0x247a}, // sevenparen {0xa0e40fac, 0x337b}, // heiseierasquare {0xa0e487b8, 0x33cd}, // KKsquare @@ -2848,7 +2610,6 @@ static struct Hash2Unicode { {0xa12d2230, 0x05b5}, // tsere2b {0xa134a191, 0xff11}, // onemonospace {0xa14f5367, 0x05b0}, // sheva15 - {0xa14fd78e, 0x2193}, // arrowbt {0xa157c7c6, 0x0643}, // kafarabic {0xa15811a3, 0x061f}, // questionarabic {0xa1697005, 0x0015}, // controlNAK @@ -2860,7 +2621,6 @@ static struct Hash2Unicode { {0xa20cadbf, 0x0062}, // b {0xa20ea9da, 0x24aa}, // oparen {0xa212ed2d, 0x0e38}, // sarauthai - {0xa23bb3ad, 0x222b}, // integraltext {0xa2448aa1, 0x01e6}, // Gcaron {0xa2543878, 0x326f}, // nieunacirclekorean {0xa254ebdd, 0xfb3e}, // memdagesh @@ -2894,7 +2654,6 @@ static struct Hash2Unicode { {0xa3fe88d1, 0x0104}, // Aogonek {0xa40369ed, 0x32a9}, // ideographicmedicinecircle {0xa4259ac9, 0xff76}, // kakatakanahalfwidth - {0xa43a91b7, 0x005b}, // bracketleftbig {0xa43cdc2e, 0xfb44}, // pedageshhebrew {0xa446d45f, 0x3224}, // fiveideographicparen {0xa450f946, 0x0454}, // afii10101 @@ -2910,7 +2669,6 @@ static struct Hash2Unicode { {0xa4aa8935, 0xff58}, // xmonospace {0xa4af8f73, 0x2282}, // subset {0xa4decb10, 0x0a72}, // irigurmukhi - {0xa4ebd5d8, 0x05e7}, // qofhiriqhebrew {0xa50a3a99, 0x0630}, // afii57424 {0xa50cf621, 0xff7e}, // sekatakanahalfwidth {0xa512e58d, 0xff83}, // tekatakanahalfwidth @@ -2927,7 +2685,6 @@ static struct Hash2Unicode { {0xa60745ee, 0x2250}, // approaches {0xa6281f81, 0x0142}, // lslash {0xa62afc92, 0x0534}, // Daarmenian - {0xa63a8cce, 0xf7f4}, // Ocircumflexsmall {0xa6454b66, 0x2498}, // seventeenperiod {0xa64723d6, 0x30af}, // kukatakana {0xa6522894, 0x24da}, // kcircle @@ -2947,7 +2704,6 @@ static struct Hash2Unicode { {0xa6e68e9f, 0x0966}, // zerodeva {0xa6f16c03, 0x03c2}, // sigma1 {0xa6f2df0d, 0x0a32}, // lagurmukhi - {0xa6f3cb6a, 0x21d3}, // arrowdblbt {0xa716a470, 0x2464}, // fivecircle {0xa71dfe13, 0x1ea2}, // Ahookabove {0xa73026ce, 0x007a}, // z @@ -2978,7 +2734,6 @@ static struct Hash2Unicode { {0xa8547bdd, 0x0455}, // afii10102 {0xa8665e8d, 0x05b1}, // afii57801 {0xa877e561, 0x2642}, // male - {0xa87899cd, 0xf6e6}, // hyphensuperior {0xa8982f3b, 0x09b2}, // labengali {0xa8a24959, 0x00d0}, // Eth {0xa8b6c7f5, 0x0a2e}, // magurmukhi @@ -3000,10 +2755,7 @@ static struct Hash2Unicode { {0xa9a0932f, 0x2077}, // sevensuperior {0xa9af18f2, 0x30b4}, // gokatakana {0xa9c0b182, 0x2264}, // lessequal - {0xa9dc390a, 0x05da}, // finalkafqamatshebrew - {0xa9e88297, 0x2053}, // a58 {0xaa13efde, 0x007d}, // braceright - {0xaa245bb8, 0x0028}, // parenleftBig {0xaa4e278b, 0x0967}, // onedeva {0xaa51d75f, 0x2476}, // threeparen {0xaa69d0f1, 0x256c}, // SF440000 @@ -3024,7 +2776,6 @@ static struct Hash2Unicode { {0xab24577f, 0x0667}, // sevenarabic {0xab2b4200, 0x2105}, // careof {0xab3b4b27, 0x24e2}, // scircle - {0xab52e61f, 0x05d3}, // dalethatafpatah {0xab808d1e, 0x2087}, // seveninferior {0xab8a6656, 0x01d0}, // icaron {0xaba55a59, 0xfb32}, // gimeldageshhebrew @@ -3039,7 +2790,6 @@ static struct Hash2Unicode { {0xac50a082, 0x33a3}, // mmcubedsquare {0xac5faca7, 0x230b}, // floorrightbig {0xac67aca2, 0x045b}, // tshecyrillic - {0xacac7818, 0x219d}, // a59 {0xacb92bab, 0x0691}, // rreharabic {0xacd00f05, 0x21c6}, // arrowleftoverright {0xacd11e18, 0x2010}, // hyphentwo @@ -3051,7 +2801,6 @@ static struct Hash2Unicode { {0xad33f4b3, 0x04c1}, // Zhebrevecyrillic {0xad37f8e0, 0x0a24}, // tagurmukhi {0xad38bc31, 0x2194}, // arrowboth - {0xad45a65c, 0xf6cc}, // DieresisAcute {0xad5fe438, 0x0924}, // tadeva {0xad781e89, 0x200c}, // afii61664 {0xad8ff38a, 0x0a21}, // ddagurmukhi @@ -3062,27 +2811,22 @@ static struct Hash2Unicode { {0xadf402a9, 0x0989}, // ubengali {0xadf4d422, 0x0625}, // alefhamzabelowarabic {0xae04e5ad, 0x0a15}, // kagurmukhi - {0xae06976c, 0xf6d5}, // cyrflex {0xae1f7b0a, 0x2076}, // sixsuperior {0xae23dd7b, 0x1eaf}, // abreveacute {0xae30147f, 0x0908}, // iideva - {0xae346d0d, 0x05e8}, // reshsheva {0xae56317c, 0x24ae}, // sparen {0xae6f7e74, 0x031b}, // horncmb {0xae7c975f, 0x249a}, // nineteenperiod {0xae8f4e4c, 0x0406}, // afii10055 - {0xaeac4f55, 0xf7e9}, // Eacutesmall {0xaeb06274, 0x0423}, // Ucyrillic {0xaec173e8, 0x03b8}, // theta {0xaee16fb6, 0xfe4f}, // underscorewavy {0xaef4b475, 0x1edf}, // ohornhookabove {0xaef8393d, 0x0664}, // fourarabic {0xaf01f370, 0x278e}, // fivecircleinversesansserif - {0xaf0ebb84, 0xf6d6}, // dblgrave {0xaf2073fd, 0x2103}, // centigrade {0xaf3552ce, 0x3072}, // hihiragana {0xaf36c6b1, 0x30cd}, // nekatakana - {0xaf499180, 0x2309}, // ceilingrightBig {0xaf4df0df, 0xfc0e}, // tehmeemisolatedarabic {0xaf5710c9, 0x00c0}, // Agrave {0xaf5b123d, 0x032d}, // circumflexbelowcmb @@ -3097,7 +2841,6 @@ static struct Hash2Unicode { {0xafbbfcac, 0xff71}, // akatakanahalfwidth {0xafbd0738, 0x305d}, // sohiragana {0xafc9b657, 0x0e17}, // thothahanthai - {0xaff892ca, 0x05d3}, // dalettserehebrew {0xb000150a, 0xfe96}, // tehfinalarabic {0xb01f8020, 0x0666}, // sixarabic {0xb026a3ef, 0x30b3}, // kokatakana @@ -3139,12 +2882,8 @@ static struct Hash2Unicode { {0xb2d7f27b, 0x0652}, // afii57458 {0xb2d95c63, 0x2518}, // SF040000 {0xb2f3aff0, 0x0946}, // eshortvowelsigndeva - {0xb311c284, 0x05e7}, // qoftsere {0xb3178333, 0x00da}, // Uacute {0xb321fe9c, 0x21e3}, // arrowdashdown - {0xb327a481, 0x2290}, // a61 - {0xb32daf91, 0xf6c6}, // afii10192 - {0xb32e268f, 0xf6fe}, // Tildesmall {0xb3329e90, 0x313e}, // rieulthieuthkorean {0xb33c41bc, 0x018c}, // dtopbar {0xb340e2fe, 0x04a5}, // enghecyrillic @@ -3160,7 +2899,6 @@ static struct Hash2Unicode { {0xb3ed41be, 0x328f}, // ideographearthcircle {0xb40169ac, 0x05b0}, // sheva22 {0xb405e3e3, 0x0439}, // afii10075 - {0xb40aff3d, 0xf730}, // zerooldstyle {0xb41baecc, 0x2487}, // twentyparen {0xb427632e, 0x05b3}, // hatafqamats1b {0xb4344c30, 0x090f}, // edeva @@ -3168,7 +2906,6 @@ static struct Hash2Unicode { {0xb448d464, 0x0391}, // Alpha {0xb45a5763, 0x201b}, // quoteleftreversed {0xb45ef9b7, 0x03c0}, // pi - {0xb47a6410, 0x230a}, // floorleftBigg {0xb497903a, 0x01dd}, // eturned {0xb4a55071, 0x1e7d}, // vtilde {0xb4a6b289, 0x2235}, // because @@ -3179,13 +2916,11 @@ static struct Hash2Unicode { {0xb4c667bc, 0xff61}, // periodhalfwidth {0xb4c72b2a, 0x0215}, // udblgrave {0xb4e21f31, 0x2198}, // arrowdownright - {0xb4fef2ed, 0x05d3}, // dalettsere {0xb500deca, 0x1e41}, // mdotaccent {0xb510d684, 0x1e80}, // Wgrave {0xb526b685, 0x22bf}, // righttriangle {0xb52e7c1d, 0x091e}, // nyadeva {0xb53ca7e2, 0x326c}, // phieuphcirclekorean - {0xb5866d85, 0x005c}, // backslashbig {0xb58e59d7, 0x24ad}, // rparen {0xb5af274f, 0x064a}, // afii57450 {0xb5b94593, 0x010d}, // ccaron @@ -3202,7 +2937,6 @@ static struct Hash2Unicode { {0xb66bf9b9, 0x33dc}, // svsquare {0xb673fbb5, 0x038e}, // Upsilontonos {0xb67e35c8, 0x0121}, // gdotaccent - {0xb6951f83, 0x2210}, // coproductdisplay {0xb6bb2a6b, 0x0116}, // Edot {0xb6d45c54, 0xff7a}, // kokatakanahalfwidth {0xb6f322b3, 0x05e5}, // afii57685 @@ -3211,7 +2945,6 @@ static struct Hash2Unicode { {0xb6fea9e7, 0xff3f}, // underscoremonospace {0xb70f3f60, 0xff4e}, // nmonospace {0xb711b601, 0x039d}, // Nu - {0xb7124c93, 0xf770}, // Psmall {0xb719922a, 0x067e}, // afii57506 {0xb71d84e2, 0x3167}, // nieunsioskorean {0xb726c42e, 0xfb49}, // shindageshhebrew @@ -3255,13 +2988,11 @@ static struct Hash2Unicode { {0xb9dbedd2, 0x317b}, // siosnieunkorean {0xb9e5ea71, 0x314c}, // thieuthkorean {0xb9e8b13e, 0x25a0}, // filledbox - {0xb9ebf396, 0xf764}, // Dsmall {0xb9f42560, 0x0964}, // danda {0xb9f5b462, 0x0990}, // aibengali {0xba1bcecd, 0x0176}, // Ycircumflex {0xba1f80d6, 0x21e1}, // arrowdashup {0xba21ad27, 0xfb3a}, // finalkafdagesh - {0xba3aaf1e, 0x27e9}, // angbracketrightBig {0xba4eb5f9, 0x0055}, // U {0xba544632, 0x05db}, // afii57675 {0xba5871eb, 0x033e}, // tildeverticalcmb @@ -3270,31 +3001,24 @@ static struct Hash2Unicode { {0xba8d69d2, 0x232a}, // angleright {0xbaa24d97, 0x05e0}, // afii57680 {0xbaa7aa4c, 0xfedc}, // kafmedialarabic - {0xbab8d5ec, 0xf771}, // Qsmall - {0xbabbf0c0, 0x05e8}, // reshhiriqhebrew {0xbac7de75, 0x1ed3}, // ocircumflexgrave {0xbad44ddc, 0x004f}, // O {0xbad7d685, 0x04b8}, // Cheverticalstrokecyrillic {0xbad97612, 0x03af}, // iotatonos {0xbadf80e2, 0x06f5}, // fivepersian - {0xbae37657, 0x0621}, // hamzalowkasratanarabic {0xbafeb301, 0x0422}, // Tecyrillic {0xbb28e2ea, 0x1eb2}, // Abrevehookabove {0xbb30f37e, 0x0218}, // Scommaaccent {0xbb6353b2, 0x0332}, // lowlinecmb - {0xbb66e953, 0x22c8}, // a49 {0xbb72d76e, 0x0139}, // Lacute - {0xbb89235d, 0xf6e0}, // centsuperior {0xbb906e01, 0x3266}, // sioscirclekorean {0xbb970588, 0x266f}, // musicsharpsign {0xbba252f7, 0x0106}, // Cacute - {0xbba2c6f4, 0x27e9}, // angbracketrightbigg {0xbbae7b40, 0x3172}, // pieupkiyeokkorean {0xbbb9d0f4, 0x0934}, // llladeva {0xbbd8677b, 0x330d}, // karoriisquare {0xbbdbcb55, 0x0a6f}, // ninegurmukhi {0xbbdc86be, 0xfb2b}, // shinsindot - {0xbc041d93, 0x05da}, // finalkafqamats {0xbc0d2781, 0x0a1f}, // ttagurmukhi {0xbc1b1166, 0x2558}, // SF500000 {0xbc280da2, 0x1e79}, // utildeacute @@ -3303,7 +3027,6 @@ static struct Hash2Unicode { {0xbc75336c, 0x21a9}, // arrowhookright {0xbc78e14f, 0x24b0}, // uparen {0xbcd2c61b, 0x064c}, // dammatanarabic - {0xbcf16b16, 0x0621}, // hamzadammatanarabic {0xbd0f6f71, 0x004c}, // L {0xbd1a9441, 0x3235}, // ideographicspecialparen {0xbd1abdb6, 0x0184}, // Tonesix @@ -3321,14 +3044,12 @@ static struct Hash2Unicode { {0xbdc1280a, 0x24be}, // Icircle {0xbdd372da, 0x318b}, // yuyekorean {0xbde8281d, 0x3276}, // cieucacirclekorean - {0xbe1bc796, 0xfb7c}, // tchehmeeminitialarabic {0xbe3e45cf, 0xfb58}, // pehinitialarabic {0xbe663ca6, 0x2470}, // seventeencircle {0xbe7a58ae, 0x3203}, // rieulparenkorean {0xbea937fd, 0x25bc}, // blackdownpointingtriangle {0xbec6916e, 0x011c}, // Gcircumflex {0xbedd6640, 0x00d9}, // Ugrave - {0xbee1ad99, 0xed79}, // vextenddouble {0xbf12496a, 0x0985}, // abengali {0xbf156070, 0x04e2}, // Imacroncyrillic {0xbf26dc61, 0x041d}, // Encyrillic @@ -3345,7 +3066,6 @@ static struct Hash2Unicode { {0xbf9c1926, 0x0627}, // alefarabic {0xbfc69ab7, 0xff18}, // eightmonospace {0xbfd3ede4, 0x0396}, // Zeta - {0xbfe44580, 0x05d3}, // dalethiriq {0xbffa52a3, 0x33c7}, // cosquare {0xc006a810, 0x062a}, // teharabic {0xc008508a, 0xff1c}, // lessmonospace @@ -3359,7 +3079,6 @@ static struct Hash2Unicode { {0xc092fb91, 0x1e95}, // zlinebelow {0xc09823db, 0x016f}, // uring {0xc09889a1, 0x1e11}, // dcedilla - {0xc09e394d, 0x2211}, // summationtext {0xc0a2bc69, 0x2564}, // SF470000 {0xc0a93f4f, 0x0e2c}, // lochulathai {0xc0bd9f90, 0x094a}, // oshortvowelsigndeva @@ -3369,7 +3088,6 @@ static struct Hash2Unicode { {0xc0d444a4, 0x3220}, // oneideographicparen {0xc0dcb90f, 0x062e}, // khaharabic {0xc0efe98c, 0x2191}, // arrowup - {0xc0f7b81d, 0xf888}, // saraueeleftthai {0xc0fb3832, 0x25ab}, // H18551 {0xc131664b, 0x30e4}, // yakatakana {0xc1425417, 0x317a}, // sioskiyeokkorean @@ -3382,7 +3100,6 @@ static struct Hash2Unicode { {0xc1e02cdd, 0x0594}, // zaqefqatanhebrew {0xc1e3fd2d, 0x05d5}, // vav {0xc1e4c743, 0x3057}, // sihiragana - {0xc1e7aebd, 0xf779}, // Ysmall {0xc1ec1451, 0x03c3}, // sigma {0xc1f9ede7, 0x05a3}, // munahhebrew {0xc2089a04, 0x05b7}, // patah1d @@ -3399,15 +3116,13 @@ static struct Hash2Unicode { {0xc2c391b3, 0x25b2}, // triagup {0xc2d0d165, 0x0137}, // kcommaaccent {0xc2db7e0f, 0x04a0}, // Kabashkircyrillic - {0xc327f9ff, 0xf8eb}, // parenlefttp + {0xc327f9ff, 0x239b}, // parenlefttp {0xc32ea721, 0x061f}, // afii57407 - {0xc347a5d5, 0x22c1}, // logicalordisplay {0xc36634d0, 0x09f9}, // sixteencurrencydenominatorbengali {0xc3722d19, 0x23ad}, // bracerightbt {0xc3751bae, 0x25ab}, // whitesmallsquare {0xc375a046, 0x05b0}, // shevahebrew {0xc391e9a8, 0xfe50}, // commasmall - {0xc3a63833, 0x0621}, // hamzasukunarabic {0xc3c94bba, 0x306a}, // nahiragana {0xc3d9dd70, 0xfe43}, // whitecornerbracketleftvertical {0xc3df4586, 0x0903}, // visargadeva @@ -3454,17 +3169,15 @@ static struct Hash2Unicode { {0xc6649ea6, 0x263b}, // blacksmilingface {0xc6730a47, 0x3230}, // ideographicsunparen {0xc6a18663, 0x2173}, // fourroman - {0xc6a33bcf, 0xf8f9}, // bracketrighttp + {0xc6a33bcf, 0x23a4}, // bracketrighttp {0xc6bb9cde, 0x03c1}, // rho {0xc6c2ca67, 0x0537}, // Eharmenian {0xc6db1db1, 0x0a94}, // augujarati {0xc6ddc5a6, 0x0334}, // tildeoverlaycmb {0xc6e9fa39, 0x064a}, // yeharabic {0xc6fbfdac, 0x025a}, // schwahook - {0xc6fedf58, 0xf731}, // oneoldstyle {0xc703d8e7, 0x33b8}, // kvsquare - {0xc7199c26, 0xf763}, // Csmall - {0xc71e49b3, 0xf8fa}, // bracketrightex + {0xc71e49b3, 0x23a5}, // bracketrightex {0xc74688aa, 0x24dc}, // mcircle {0xc74a8cc7, 0x05b5}, // tserequarterhebrew {0xc74f4c99, 0x0298}, // bilabialclick @@ -3476,7 +3189,6 @@ static struct Hash2Unicode { {0xc76c439e, 0x0115}, // ebreve {0xc76ec8b2, 0x0e1c}, // phophungthai {0xc77c2828, 0x2206}, // Delta - {0xc7855795, 0xf894}, // maichattawalowrightthai {0xc786ef31, 0x095b}, // zadeva {0xc78887c7, 0x1e08}, // Ccedillaacute {0xc78fe323, 0x0698}, // afii57508 @@ -3488,7 +3200,6 @@ static struct Hash2Unicode { {0xc7f07bcf, 0x248f}, // eightperiod {0xc7f0b4c8, 0x0406}, // Icyrillic {0xc7fb5fe5, 0x05b2}, // afii57800 - {0xc808d8ed, 0xf8f5}, // integralex {0xc812d1b7, 0x041b}, // afii10029 {0xc82c0a32, 0x026f}, // mturned {0xc834804d, 0x2475}, // twoparen @@ -3506,8 +3217,6 @@ static struct Hash2Unicode { {0xc8cf912e, 0xfe59}, // parenleftsmall {0xc8fcce82, 0x0424}, // Efcyrillic {0xc8fdfe4b, 0x0914}, // audeva - {0xc9033cb3, 0x05e7}, // qofhatafpatahhebrew - {0xc905dac2, 0xf7e0}, // Agravesmall {0xc9315b90, 0x0338}, // soliduslongoverlaycmb {0xc93304ec, 0x2176}, // sevenroman {0xc9366418, 0x1e7e}, // Vdotbelow @@ -3526,7 +3235,6 @@ static struct Hash2Unicode { {0xc9eb1227, 0x321c}, // cieucuparenkorean {0xca07e9ca, 0x02dd}, // hungarumlaut {0xca0b3331, 0x1e5f}, // rlinebelow - {0xca0f9f38, 0xf887}, // saraueleftthai {0xca2dd9fa, 0x2590}, // rtblock {0xca5ed753, 0x0269}, // iotalatin {0xca65e972, 0x0646}, // noonarabic @@ -3554,9 +3262,7 @@ static struct Hash2Unicode { {0xcbada403, 0x0429}, // Shchacyrillic {0xcc11d7b0, 0x000c}, // controlFF {0xcc261604, 0x04a2}, // Endescendercyrillic - {0xcc2b60a5, 0x05e7}, // qofhiriq {0xcc3139de, 0x33d1}, // squareln - {0xcc334bff, 0xf766}, // Fsmall {0xcc3accb9, 0x05d8}, // tethebrew {0xcc3b7b5c, 0x0649}, // alefmaksuraarabic {0xcc447b1d, 0x0296}, // glottalstopinverted @@ -3581,7 +3287,6 @@ static struct Hash2Unicode { {0xcd9d27ad, 0x24c7}, // Rcircle {0xcd9f5a2c, 0x0028}, // parenleft {0xcda0c667, 0x2018}, // quoteleft - {0xcdab3631, 0xf7ff}, // Ydieresissmall {0xcdae6ea2, 0xff59}, // ymonospace {0xcdbb64f4, 0x2105}, // afii61248 {0xcdd2cfab, 0x24b4}, // yparen @@ -3592,14 +3297,12 @@ static struct Hash2Unicode { {0xcdfd40ec, 0x0180}, // bstroke {0xce074882, 0x0668}, // afii57400 {0xce4d2d1e, 0x2563}, // SF230000 - {0xce63250d, 0x005d}, // bracketrightBigg {0xce6d06c6, 0x0aab}, // phagujarati {0xce6f0d59, 0x3272}, // mieumacirclekorean {0xce79a056, 0x3339}, // herutusquare {0xce8dac39, 0x25a8}, // squareupperrighttolowerleftfill {0xce942ad9, 0x09a6}, // dabengali {0xcea39f20, 0x02d5}, // downtackmod - {0xced82ba6, 0xed19}, // bracehtipupleft {0xcedf2a68, 0x0157}, // rcedilla {0xcee9759d, 0x043a}, // afii10076 {0xcef01870, 0x0171}, // udblacute @@ -3620,7 +3323,6 @@ static struct Hash2Unicode { {0xcfe519cb, 0x309b}, // voicedmarkkana {0xcfe64e44, 0x0668}, // eighthackarabic {0xcff88b7d, 0x05b8}, // qamatsqatannarrowhebrew - {0xd009507e, 0x05d3}, // daletqamatshebrew {0xd0096386, 0x25b3}, // whiteuppointingtriangle {0xd0227bd1, 0x0199}, // khook {0xd02a9cfe, 0x0105}, // aogonek @@ -3634,7 +3336,6 @@ static struct Hash2Unicode { {0xd056aca3, 0xff9a}, // rekatakanahalfwidth {0xd06b6bb7, 0x096a}, // fourdeva {0xd07a803b, 0x09aa}, // pabengali - {0xd07f3aad, 0xf768}, // Hsmall {0xd0847e20, 0x05c4}, // upperdothebrew {0xd087e60f, 0x0158}, // Rcaron {0xd0897bb6, 0x0579}, // chaarmenian @@ -3648,9 +3349,7 @@ static struct Hash2Unicode { {0xd13faec5, 0x05e1}, // samekh {0xd14fc185, 0x045b}, // afii10108 {0xd17987dd, 0x0543}, // Cheharmenian - {0xd180d934, 0x0621}, // hamzalowkasraarabic {0xd18447d8, 0x0663}, // threearabic - {0xd18961af, 0xf7fa}, // Uacutesmall {0xd18966b1, 0x0a82}, // anusvaragujarati {0xd18d83de, 0x0aa3}, // nnagujarati {0xd190d310, 0x0a35}, // vagurmukhi @@ -3659,7 +3358,6 @@ static struct Hash2Unicode { {0xd1d7231f, 0x04bc}, // Cheabkhasiancyrillic {0xd1d9da71, 0x30ea}, // rikatakana {0xd2337241, 0x05b6}, // segol1f - {0xd24297bf, 0xf889}, // maitaikhuleftthai {0xd247ef8b, 0x3243}, // ideographicreachparen {0xd254c368, 0x0443}, // ucyrillic {0xd2658bcb, 0x05b9}, // holamquarterhebrew @@ -3676,7 +3374,6 @@ static struct Hash2Unicode { {0xd2f3cdf3, 0x1e0e}, // Dlinebelow {0xd304784a, 0x05d3}, // dalet {0xd308b167, 0x1e5b}, // rdotbelow - {0xd310b973, 0x25a1}, // a50 {0xd310fcc1, 0x04e9}, // obarredcyrillic {0xd3145153, 0xfeec}, // hehmedialarabic {0xd326ec6d, 0x2237}, // proportion @@ -3684,7 +3381,6 @@ static struct Hash2Unicode { {0xd33cb244, 0x02cd}, // macronlowmod {0xd35ba6fb, 0x04be}, // Chedescenderabkhasiancyrillic {0xd3730282, 0xff64}, // ideographiccommaleft - {0xd3777d75, 0x05d3}, // daletsegolhebrew {0xd3797e0f, 0x24db}, // lcircle {0xd37b4bcb, 0x041c}, // afii10030 {0xd3a5ba29, 0x062e}, // afii57422 @@ -3697,11 +3393,9 @@ static struct Hash2Unicode { {0xd44f2d4c, 0xff9b}, // rokatakanahalfwidth {0xd45c6c89, 0x3079}, // behiragana {0xd467b0a3, 0x0131}, // dotlessi - {0xd46989dc, 0x05e7}, // qofholam {0xd48c064b, 0x0599}, // pashtahebrew {0xd48dad4d, 0x01e2}, // AEmacron {0xd4b2bb68, 0x0145}, // Ncedilla - {0xd4ce7b9e, 0x0621}, // hamzadammaarabic {0xd4d3eb56, 0x255e}, // SF360000 {0xd4e86e58, 0x1ef7}, // yhookabove {0xd4e92fa8, 0x0623}, // alefhamzaabovearabic @@ -3715,7 +3409,6 @@ static struct Hash2Unicode { {0xd5b6f4bf, 0x3163}, // ikorean {0xd5b7a706, 0x1e13}, // dcircumflexbelow {0xd5da03ab, 0x0123}, // gcommaaccent - {0xd5da183e, 0xf76e}, // Nsmall {0xd5dc1f0e, 0x24a5}, // jparen {0xd5e6a2b4, 0x200f}, // afii300 {0xd6067104, 0x05bd}, // siluqlefthebrew @@ -3736,17 +3429,14 @@ static struct Hash2Unicode { {0xd6df6252, 0xfef4}, // yehmedialarabic {0xd6e234de, 0x044d}, // afii10095 {0xd7151c8a, 0x040b}, // afii10060 - {0xd71970f6, 0x05d3}, // daletsegol {0xd71af0cf, 0x00af}, // overscore {0xd72c6112, 0x0036}, // six - {0xd7363d15, 0x05d3}, // daletholamhebrew {0xd73b3901, 0x02da}, // ring {0xd7425de1, 0x0a1d}, // jhagurmukhi {0xd771b953, 0x3107}, // mbopomofo {0xd7a40cc3, 0x315c}, // ukorean {0xd7b7f8a3, 0x3094}, // vuhiragana {0xd7b8c7af, 0x05b8}, // qamatsquarterhebrew - {0xd7bc737d, 0x230b}, // floorrightBig {0xd7bf0d2a, 0x308b}, // ruhiragana {0xd7cebade, 0x01b1}, // Upsilonafrican {0xd7d268b5, 0x314e}, // hieuhkorean @@ -3756,7 +3446,6 @@ static struct Hash2Unicode { {0xd8171429, 0x013e}, // lcaron {0xd817c39d, 0x0664}, // fourhackarabic {0xd824acfb, 0x05de}, // memhebrew - {0xd82c0976, 0x05e8}, // reshsegolhebrew {0xd849e14d, 0x3052}, // gehiragana {0xd84afb0a, 0x00d1}, // Ntilde {0xd85534fc, 0x02ca}, // secondtonechinese @@ -3780,7 +3469,6 @@ static struct Hash2Unicode { {0xd95c2f59, 0x04bd}, // cheabkhasiancyrillic {0xd9697a13, 0x328b}, // ideographfirecircle {0xd98cc91f, 0x0307}, // dotaccentcmb - {0xd98dcef9, 0xf8ff}, // apple {0xd991004f, 0x0e4f}, // fongmanthai {0xd99e3976, 0x249f}, // dparen {0xd9ba695c, 0xff70}, // katahiraprolongmarkhalfwidth @@ -3790,7 +3478,6 @@ static struct Hash2Unicode { {0xda15411c, 0x0304}, // macroncmb {0xda2037e1, 0x1e01}, // aringbelow {0xda3670ae, 0x3347}, // mansyonsquare - {0xda38804a, 0xf738}, // eightoldstyle {0xda39b9df, 0x013d}, // Lcaron {0xda48ff7e, 0x00bb}, // guillemotright {0xda4e1891, 0x228b}, // supersetnotequal @@ -3801,11 +3488,9 @@ static struct Hash2Unicode { {0xda94576a, 0x0999}, // ngabengali {0xda94a677, 0x0634}, // afii57428 {0xda99b3d7, 0x30d1}, // pakatakana - {0xda9d5f69, 0xf6c8}, // afii10832 {0xdab46527, 0x21e9}, // arrowdownwhite {0xdac4a95a, 0x002f}, // slash {0xdac8670b, 0x011e}, // Gbreve - {0xdace8a4c, 0xed17}, // bracehtipdownleft {0xdad5813e, 0x24bf}, // Jcircle {0xdaf9ae21, 0x03e7}, // kheicoptic {0xdb00acb2, 0x04dc}, // Zhedieresiscyrillic @@ -3813,15 +3498,12 @@ static struct Hash2Unicode { {0xdb15243d, 0xfb38}, // tetdagesh {0xdb180684, 0x059d}, // gereshmuqdamhebrew {0xdb19f222, 0x1e30}, // Kacute - {0xdb215045, 0xf76f}, // Osmall {0xdb36c0cb, 0x00c1}, // Aacute {0xdb46a061, 0x044f}, // afii10097 {0xdb4843d8, 0x0140}, // ldotaccent {0xdb491e12, 0x3201}, // nieunparenkorean {0xdb4ecb82, 0x06a4}, // afii57505 {0xdb5fdfb2, 0x09cd}, // viramabengali - {0xdb7c2cdb, 0xf88f}, // maitholowleftthai - {0xdb8ff30c, 0xf6f5}, // Caronsmall {0xdb9c2f74, 0x3063}, // tusmallhiragana {0xdb9dda85, 0xfb3b}, // kafdageshhebrew {0xdba170e8, 0x0998}, // ghabengali @@ -3833,7 +3515,6 @@ static struct Hash2Unicode { {0xdbf12380, 0x2460}, // onecircle {0xdc0071a3, 0xfb46}, // tsadidageshhebrew {0xdc05ec50, 0x30f5}, // kasmallkatakana - {0xdc0ac9c6, 0x0028}, // parenleftBigg {0xdc0ad3ae, 0x012d}, // ibreve {0xdc0c240d, 0xff9e}, // voicedmarkkanahalfwidth {0xdc0c9e85, 0xff9f}, // semivoicedmarkkanahalfwidth @@ -3841,7 +3522,6 @@ static struct Hash2Unicode { {0xdc41d3b3, 0x05ab}, // olehebrew {0xdc54447c, 0x307c}, // bohiragana {0xdc6ca9b3, 0x0584}, // keharmenian - {0xdc7650d9, 0xf73f}, // questionsmall {0xdc7756d1, 0x0077}, // w {0xdc7d1de8, 0xfba9}, // hehmedialaltonearabic {0xdc7f6ca5, 0x0624}, // wawhamzaabovearabic @@ -3888,33 +3568,25 @@ static struct Hash2Unicode { {0xdf1ee74b, 0xff81}, // tikatakanahalfwidth {0xdf243dad, 0x044c}, // softsigncyrillic {0xdf46fba9, 0x01a4}, // Phook - {0xdf5e1052, 0x221a}, // radicalbig {0xdf80589a, 0x3217}, // chieuchaparenkorean {0xdf8c6402, 0x0e45}, // lakkhangyaothai - {0xdf8fbdeb, 0x05e7}, // qofsheva {0xdf9eaf7a, 0x33bc}, // muwsquare {0xdfad5d93, 0x22c0}, // logicalandtext {0xdfaf476d, 0x0167}, // tbar {0xdfb9632c, 0x3144}, // pieupsioskorean - {0xdfe8c3dc, 0xf7fc}, // Udieresissmall {0xdff819d0, 0xfe8c}, // yehhamzaabovemedialarabic {0xdffe3761, 0x1e14}, // Emacrongrave - {0xe0061dae, 0x05d3}, // daletpatah {0xe0130535, 0x316c}, // rieulpansioskorean {0xe019189f, 0x0994}, // aubengali {0xe0197d92, 0x0a4b}, // oomatragurmukhi - {0xe02aebf6, 0xf6e3}, // dollarinferior {0xe0343a59, 0x0323}, // dotbelowcomb {0xe03a2368, 0x019f}, // Ocenteredtilde {0xe0489c79, 0x017f}, // longs - {0xe0513bea, 0xf6ff}, // Zcaronsmall {0xe0560cdf, 0x1e19}, // ecircumflexbelow {0xe065671a, 0x1e0a}, // Ddotaccent {0xe07dfee5, 0x04f4}, // Chedieresiscyrillic {0xe0800244, 0xfb69}, // ttehmedialarabic - {0xe0831234, 0x007b}, // braceleftBig {0xe0987417, 0x24dd}, // ncircle - {0xe0ab68f9, 0xf6dc}, // onefitted {0xe0ac4869, 0x3225}, // sixideographicparen {0xe0c42e1f, 0x3357}, // wattosquare {0xe0cf3aca, 0x1e1d}, // ecedillabreve @@ -3933,9 +3605,7 @@ static struct Hash2Unicode { {0xe20234a2, 0x012c}, // Ibreve {0xe20c937f, 0x041a}, // Kacyrillic {0xe20deadd, 0x047c}, // Omegatitlocyrillic - {0xe222a727, 0x02dc}, // tildewide {0xe2234dec, 0xff52}, // rmonospace - {0xe2256c16, 0x05d3}, // daletqamats {0xe22682ea, 0x3260}, // kiyeokcirclekorean {0xe22a6510, 0x1e8e}, // Ydotaccent {0xe23968a4, 0x04b3}, // hadescendercyrillic @@ -3946,7 +3616,6 @@ static struct Hash2Unicode { {0xe28a564c, 0x044f}, // iacyrillic {0xe28eea2e, 0x1e51}, // omacrongrave {0xe2924f7e, 0x0a67}, // onegurmukhi - {0xe2948e05, 0xf6f6}, // Circumflexsmall {0xe2a7b092, 0x3213}, // pieupaparenkorean {0xe2b99909, 0x0e14}, // dodekthai {0xe2cfeeb5, 0x0301}, // acutecomb @@ -3966,7 +3635,6 @@ static struct Hash2Unicode { {0xe3a00fb0, 0x0aa2}, // ddhagujarati {0xe3a0394c, 0x05b3}, // afii57802 {0xe3bf40b5, 0x21c5}, // arrowupleftofdown - {0xe3c68591, 0x005d}, // bracketrightBig {0xe3cbb73f, 0x0459}, // afii10106 {0xe3cddac1, 0x0621}, // hamzalowarabic {0xe3d5ad06, 0x1ec0}, // Ecircumflexgrave @@ -3989,7 +3657,6 @@ static struct Hash2Unicode { {0xe4a8920f, 0x0014}, // controlDC4 {0xe4c6b94a, 0x0550}, // Reharmenian {0xe4c91eec, 0x1ea7}, // acircumflexgrave - {0xe4ce70c5, 0xfedf}, // lammeemkhahinitialarabic {0xe4d0a5c5, 0x2171}, // tworoman {0xe4de0824, 0x090b}, // rvocalicdeva {0xe4e78bbf, 0x0e33}, // saraamthai @@ -4022,7 +3689,6 @@ static struct Hash2Unicode { {0xe61a323e, 0x21d2}, // arrowdblright {0xe61dad29, 0x017b}, // Zdotaccent {0xe62fb889, 0x2524}, // SF090000 - {0xe65602bc, 0x05d3}, // daletqubuts {0xe6699f03, 0x025d}, // eopenreversedhook {0xe6743f55, 0x011a}, // Ecaron {0xe6861695, 0x018a}, // Dhook @@ -4041,7 +3707,6 @@ static struct Hash2Unicode { {0xe72762a6, 0x3127}, // ibopomofo {0xe74e8d5b, 0x02d0}, // colontriangularmod {0xe75de72d, 0x0a4d}, // halantgurmukhi - {0xe79030f9, 0xf6cf}, // Hungarumlaut {0xe796e6c1, 0x032f}, // breveinvertedbelowcmb {0xe7a9201c, 0x24e5}, // vcircle {0xe7abb869, 0x05b0}, // sheva115 @@ -4073,7 +3738,6 @@ static struct Hash2Unicode { {0xe927829f, 0x0953}, // gravedeva {0xe92a9522, 0x0060}, // grave {0xe93b2c93, 0x09c8}, // aivowelsignbengali - {0xe9544ae6, 0x2308}, // ceilingleftbigg {0xe9598c36, 0x018e}, // Ereversed {0xe96c43a5, 0x00d4}, // Ocircumflex {0xe977a63b, 0x0591}, // etnahtalefthebrew @@ -4108,7 +3772,6 @@ static struct Hash2Unicode { {0xeb4a0523, 0x056a}, // zhearmenian {0xeb4fdea3, 0xfc08}, // behmeemisolatedarabic {0xeb576d94, 0x21de}, // pageup - {0xeb6b92be, 0x2191}, // arrowtp {0xeb701704, 0x2014}, // emdash {0xeb71d801, 0x30f3}, // nkatakana {0xebeccb02, 0x00dd}, // Yacute @@ -4131,7 +3794,6 @@ static struct Hash2Unicode { {0xed1afc7c, 0x05b2}, // hatafpatah2f {0xed2b4a43, 0x00aa}, // ordfeminine {0xed4bb321, 0x313f}, // rieulphieuphkorean - {0xed65d1e6, 0x05e7}, // qofqubutshebrew {0xed65e3bb, 0x057a}, // peharmenian {0xed729d82, 0x049e}, // Kastrokecyrillic {0xed796a9e, 0x0407}, // afii10056 @@ -4159,7 +3821,6 @@ static struct Hash2Unicode { {0xef33d78e, 0x25a1}, // H22073 {0xef3a179c, 0x020a}, // Iinvertedbreve {0xef636ee0, 0x05da}, // finalkaf - {0xef7afe15, 0x007d}, // bracerightbigg {0xefa03eab, 0x00c6}, // AE {0xefc57067, 0x0260}, // ghook {0xefd65ddd, 0x2033}, // second @@ -4181,7 +3842,6 @@ static struct Hash2Unicode { {0xf064a013, 0x047e}, // Otcyrillic {0xf0673e49, 0x096f}, // ninedeva {0xf0757f39, 0x030a}, // ringcmb - {0xf08334d5, 0x05d3}, // dalethatafpatahhebrew {0xf08a28a9, 0xfe4e}, // lowlinecenterline {0xf09092b0, 0x3185}, // ssanghieuhkorean {0xf091911a, 0x223d}, // reversedtilde @@ -4210,7 +3870,6 @@ static struct Hash2Unicode { {0xf1ddaa7d, 0x0995}, // kabengali {0xf1e94d64, 0x064e}, // fathaarabic {0xf1eb4f66, 0x0116}, // Edotaccent - {0xf1f2ec50, 0x05e7}, // qofhatafsegol {0xf1f78ce7, 0x226a}, // muchless {0xf2118c6c, 0x0635}, // sadarabic {0xf232181a, 0x2640}, // venus @@ -4227,19 +3886,15 @@ static struct Hash2Unicode { {0xf2dd8deb, 0x248d}, // sixperiod {0xf2e23a0c, 0xfb57}, // pehfinalarabic {0xf2e7f536, 0x0329}, // verticallinebelowcmb - {0xf2efdad2, 0x05e8}, // reshqamats {0xf2f52e6c, 0x00ce}, // Icircumflex {0xf2f6e905, 0x24cd}, // Xcircle {0xf3086f4b, 0x2030}, // perthousand {0xf311fe21, 0xfece}, // ghainfinalarabic {0xf315dbae, 0xfe3c}, // blacklenticularbracketrightvertical - {0xf31fc2c2, 0xf76d}, // Msmall {0xf336d994, 0xfef3}, // yehinitialarabic {0xf3527249, 0xfb67}, // ttehfinalarabic - {0xf365ee1e, 0xf6f8}, // Hungarumlautsmall {0xf3935843, 0xff26}, // Fmonospace {0xf399cd14, 0x0074}, // t - {0xf3ab1b0a, 0x05d3}, // dalethatafsegol {0xf3c08521, 0x0431}, // afii10066 {0xf3ce4ef0, 0x014a}, // Eng {0xf3cfe996, 0x05b8}, // qamatsde @@ -4252,9 +3907,7 @@ static struct Hash2Unicode { {0xf4728f62, 0x06f9}, // ninepersian {0xf47778a3, 0x0958}, // qadeva {0xf47c7f06, 0x05a5}, // merkhalefthebrew - {0xf4970a5b, 0x222b}, // integraldisplay {0xf498c20b, 0xfb2c}, // shindageshshindothebrew - {0xf4a0d900, 0xf7e6}, // AEsmall {0xf4a2e6c9, 0xff8e}, // hokatakanahalfwidth {0xf4c721dd, 0x0415}, // afii10022 {0xf4d1afd1, 0x015b}, // sacute @@ -4264,7 +3917,6 @@ static struct Hash2Unicode { {0xf4f5b85f, 0x05bd}, // afii57839 {0xf4fec4c5, 0x2026}, // ellipsis {0xf4fecbee, 0x3152}, // yaekorean - {0xf521dc0d, 0xf777}, // Wsmall {0xf526b2bc, 0x09f5}, // twonumeratorbengali {0xf53d898f, 0x0122}, // Gcedilla {0xf54df907, 0x02e8}, // tonebarlowmod @@ -4287,7 +3939,6 @@ static struct Hash2Unicode { {0xf6228c58, 0x20a3}, // franc {0xf6271ec7, 0x0429}, // afii10043 {0xf630815e, 0x0577}, // shaarmenian - {0xf643d64b, 0xf774}, // Tsmall {0xf64f0a5d, 0x30f9}, // vekatakana {0xf64f6666, 0xff44}, // dmonospace {0xf6545660, 0x3333}, // huiitosquare @@ -4298,10 +3949,8 @@ static struct Hash2Unicode { {0xf68c8679, 0x3043}, // ismallhiragana {0xf68fb68d, 0x215b}, // oneeighth {0xf6909b76, 0x24a1}, // fparen - {0xf69fb673, 0xf7e4}, // Adieresissmall {0xf6b386e5, 0x1e3c}, // Lcircumflexbelow {0xf6c0ec85, 0x1e5c}, // Rdotbelowmacron - {0xf6ea45f8, 0xf6fa}, // OEsmall {0xf6f2a8b6, 0x0289}, // ubar {0xf7114d7b, 0x2502}, // SF110000 {0xf7440454, 0x045e}, // afii10110 @@ -4323,7 +3972,6 @@ static struct Hash2Unicode { {0xf885c738, 0x30d3}, // bikatakana {0xf8868f94, 0xff8c}, // hukatakanahalfwidth {0xf8892150, 0x04a8}, // Haabkhasiancyrillic - {0xf89a4fca, 0x05d3}, // daletholam {0xf89be814, 0x0abc}, // nuktagujarati {0xf8e483f7, 0x1eb5}, // abrevetilde {0xf8ef289b, 0x21df}, // pagedown @@ -4372,7 +4020,6 @@ static struct Hash2Unicode { {0xfb4678bc, 0xfe90}, // behfinalarabic {0xfb5bf4b4, 0x02cf}, // acutelowmod {0xfb5cfdc8, 0x095c}, // dddhadeva - {0xfb6edad4, 0xf6c9}, // Acute {0xfb764dd2, 0x21d3}, // arrowdbldown {0xfb7c1fd7, 0x0485}, // dasiapneumatacyrilliccmb {0xfbcf44c4, 0x018d}, // deltaturned @@ -4391,7 +4038,6 @@ static struct Hash2Unicode { {0xfc8020b6, 0xfb39}, // yoddageshhebrew {0xfc828b2d, 0x1ee4}, // Udotbelow {0xfc9cf271, 0x020d}, // odblgrave - {0xfcd52169, 0xf7ed}, // Iacutesmall {0xfce47bc6, 0x05b7}, // patah {0xfce8ddc1, 0x1e0f}, // dlinebelow {0xfce9ddb5, 0x05aa}, // yerahbenyomohebrew @@ -4407,7 +4053,7 @@ static struct Hash2Unicode { {0xfd891a4c, 0x0948}, // aivowelsigndeva {0xfd8944f5, 0x0309}, // hookabovecomb {0xfd89977d, 0x0e50}, // zerothai - {0xfd93a170, 0xf8ec}, // parenleftex + {0xfd93a170, 0x239c}, // parenleftex {0xfd99bb06, 0xfb3c}, // lameddagesh {0xfdb6c57c, 0x2215}, // divisionslash {0xfdbbbec8, 0x090d}, // ecandradeva @@ -4429,14 +4075,11 @@ static struct Hash2Unicode { {0xfee9d86c, 0x2295}, // pluscircle {0xfef651f8, 0x0688}, // afii57512 {0xff5dadf4, 0x0193}, // Ghook - {0xff7d5e86, 0x05e7}, // qoftserehebrew {0xff81c116, 0x21cd}, // arrowleftdblstroke {0xff8c00d8, 0x3386}, // MBsquare {0xff8f2931, 0x30ae}, // gikatakana {0xff90fc92, 0x0923}, // nnadeva {0xff94689d, 0x04c0}, // palochkacyrillic - {0xffce1162, 0xf734}, // fouroldstyle {0xffe38169, 0x043f}, // pecyrillic {0xfffadc30, 0x2568}, // SF460000 -}; - +}}; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.cpp index fa506dbd994..88eeefdb69e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.cpp @@ -2,7 +2,7 @@ ** BasicDVIReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -21,7 +21,7 @@ #include <config.h> #include <algorithm> #include <sstream> -#include "BasicDVIReader.h" +#include "BasicDVIReader.hpp" using namespace std; @@ -87,27 +87,27 @@ int BasicDVIReader::evalCommand (CommandHandler &handler, int ¶m) { int num_param_bytes = 0; param = -1; - if (opcode >= 0 && opcode <= 127) { + if (opcode >= OP_SETCHAR0 && opcode <= OP_SETCHAR127) { handler = &BasicDVIReader::cmdSetChar0; param = opcode; } - else if (opcode >= 171 && opcode <= 234) { + else if (opcode >= OP_FNTNUM0 && opcode <= OP_FNTNUM63) { handler = &BasicDVIReader::cmdFontNum0; - param = opcode-171; + param = opcode-OP_FNTNUM0; } else if (evalXDVOpcode(opcode, handler)) num_param_bytes = 0; - else if (_dviVersion == DVI_PTEX && opcode == 255) { // direction command set by pTeX? + else if (_dviVersion == DVI_PTEX && opcode == OP_DIR) { // direction command set by pTeX? handler = &BasicDVIReader::cmdDir; num_param_bytes = 1; } - else if (opcode >= 250) { + else if (opcode > OP_POSTPOST) { ostringstream oss; oss << "undefined DVI command (opcode " << opcode << ')'; throw DVIException(oss.str()); } else { - const int offset = opcode <= 170 ? 128 : 235-(170-128+1); + const int offset = opcode < OP_FNTNUM0 ? OP_SET1 : (OP_FNTNUM63+1)-(OP_FNTNUM0-OP_SET1); handler = commands[opcode-offset].handler; num_param_bytes = commands[opcode-offset].length; } @@ -133,11 +133,11 @@ bool BasicDVIReader::evalXDVOpcode (int op, CommandHandler &handler) const { return false; static const CommandHandler handlers[] = { - &BasicDVIReader::cmdXPic, - &BasicDVIReader::cmdXFontDef, - &BasicDVIReader::cmdXGlyphArray, - &BasicDVIReader::cmdXTextAndGlyphs, - &BasicDVIReader::cmdXGlyphString + &BasicDVIReader::cmdXPic, // 251 (XDV5 only) + &BasicDVIReader::cmdXFontDef, // 252 + &BasicDVIReader::cmdXGlyphArray, // 253 + &BasicDVIReader::cmdXTextAndGlyphs, // 254 (XDV7 only) + &BasicDVIReader::cmdXGlyphString // 254 (XDV5 only) }; index = op-251; if (_dviVersion == DVI_XDV5 && op == 254) @@ -166,7 +166,7 @@ void BasicDVIReader::executePostPost () { seek(-1, ios::end); // stream pointer to last byte int count=0; - while (peek() == 223) { // count trailing fill bytes + while (peek() == DVI_FILL) { // count trailing fill bytes seek(-1, ios::cur); count++; } @@ -179,9 +179,9 @@ void BasicDVIReader::executePostPost () { void BasicDVIReader::executeAllPages () { if (_dviVersion == DVI_NONE) - executePostPost(); // get version ID from post_post - seek(0); // go to preamble - while (executeCommand() != 248); // execute all commands until postamble is reached + executePostPost(); // get version ID from post_post + seek(0); // go to preamble + while (executeCommand() != OP_POST); // execute all commands until postamble is reached } @@ -207,9 +207,9 @@ void BasicDVIReader::setDVIVersion (DVIVersion version) { * Format: pre i[1] num[4] den[4] mag[4] k[1] x[k] */ void BasicDVIReader::cmdPre (int) { setDVIVersion((DVIVersion)readUnsigned(1)); // identification number - seek(12, ios::cur); // skip numerator, denominator, and mag factor - UInt32 k = readUnsigned(1); // length of following comment - seek(k, ios::cur); // skip comment + seek(12, ios::cur); // skip numerator, denominator, and mag factor + uint32_t k = readUnsigned(1); // length of following comment + seek(k, ios::cur); // skip comment } @@ -225,7 +225,7 @@ void BasicDVIReader::cmdPost (int) { void BasicDVIReader::cmdPostPost (int) { seek(4, ios::cur); setDVIVersion((DVIVersion)readUnsigned(1)); // identification byte - while (readUnsigned(1) == 223); // skip fill bytes (223), eof bit should be set now + while (readUnsigned(1) == DVI_FILL); // skip fill bytes (223), eof bit should be set now } @@ -261,9 +261,9 @@ void BasicDVIReader::cmdXXX (int len) {seek(readUnsigned(len), ios::cur);} * Format: fontdef k[len] c[4] s[4] d[4] a[1] l[1] n[a+l] * @param[in] len size of font number variable (in bytes) */ void BasicDVIReader::cmdFontDef (int len) { - seek(len+12, ios::cur); // skip font number - UInt32 pathlen = readUnsigned(1); // length of font path - UInt32 namelen = readUnsigned(1); // length of font name + seek(len+12, ios::cur); // skip font number + uint32_t pathlen = readUnsigned(1); // length of font path + uint32_t namelen = readUnsigned(1); // length of font name seek(pathlen+namelen, ios::cur); } @@ -272,15 +272,15 @@ void BasicDVIReader::cmdFontDef (int len) { * parameters: box[1] matrix[4][6] p[2] len[2] path[l] */ void BasicDVIReader::cmdXPic (int) { seek(1+24+2, ios::cur); - UInt16 len = readUnsigned(2); + uint16_t len = readUnsigned(2); seek(len, ios::cur); } void BasicDVIReader::cmdXFontDef (int) { seek(4+4, ios::cur); - UInt16 flags = readUnsigned(2); - UInt8 len = readUnsigned(1); + uint16_t flags = readUnsigned(2); + uint8_t len = readUnsigned(1); if (_dviVersion == DVI_XDV5) len += readUnsigned(1)+readUnsigned(1); seek(len, ios::cur); @@ -295,7 +295,7 @@ void BasicDVIReader::cmdXFontDef (int) { if (flags & 0x4000) // embolden? seek(4, ios::cur); if ((flags & 0x0800) && (_dviVersion == DVI_XDV5)) { // variations? - UInt16 num_variations = readSigned(2); + uint16_t num_variations = readSigned(2); seek(4*num_variations, ios::cur); } } @@ -306,7 +306,7 @@ void BasicDVIReader::cmdXFontDef (int) { * parameters: w[4] n[2] xy[(4+4)n] g[2n] */ void BasicDVIReader::cmdXGlyphArray (int) { seek(4, ios::cur); - UInt16 num_glyphs = readUnsigned(2); + uint16_t num_glyphs = readUnsigned(2); seek(10*num_glyphs, ios::cur); } @@ -316,7 +316,7 @@ void BasicDVIReader::cmdXGlyphArray (int) { * parameters: w[4] n[2] x[4n] y[4] g[2n] */ void BasicDVIReader::cmdXGlyphString (int) { seek(4, ios::cur); - UInt16 num_glyphs = readUnsigned(2); + uint16_t num_glyphs = readUnsigned(2); seek(6*num_glyphs, ios::cur); } @@ -328,7 +328,7 @@ void BasicDVIReader::cmdXGlyphString (int) { * introduced with XeTeX 0.99995 and can be triggered by <tt>\\XeTeXgenerateactualtext1</tt>. * parameters: l[2] t[2l] w[4] n[2] xy[8n] g[2n] */ void BasicDVIReader::cmdXTextAndGlyphs (int) { - UInt16 l = readUnsigned(2); + uint16_t l = readUnsigned(2); seek(2*l, ios::cur); cmdXGlyphArray(0); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.hpp index e96df470b06..cf2d8194e04 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** BasicDVIReader.h ** +** BasicDVIReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,11 +18,11 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_BASICDVIREADER_H -#define DVISVGM_BASICDVIREADER_H +#ifndef BASICDVIREADER_HPP +#define BASICDVIREADER_HPP -#include "MessageException.h" -#include "StreamReader.h" +#include "MessageException.hpp" +#include "StreamReader.hpp" struct DVIException : public MessageException { @@ -49,10 +49,12 @@ class BasicDVIReader : public StreamReader protected: typedef void (BasicDVIReader::*CommandHandler)(int); enum DVIVersion {DVI_NONE=0, DVI_STANDARD=2, DVI_PTEX=3, DVI_XDV5=5, DVI_XDV6=6, DVI_XDV7=7}; + const uint8_t OP_SETCHAR0=0, OP_SETCHAR127=127, OP_SET1=128, OP_EOP=140, OP_FNTNUM0=171, OP_FNTNUM63=234, + OP_PRE=247, OP_POST=248, OP_POSTPOST=249, OP_DIR=255, DVI_FILL=223; public: explicit BasicDVIReader (std::istream &is); - virtual ~BasicDVIReader () {} + virtual ~BasicDVIReader () =default; virtual void executeAllPages (); virtual double getXPos () const {return 0;} virtual double getYPos () const {return 0;} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.cpp index f7710ac7518..5a342fbb111 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.cpp @@ -2,7 +2,7 @@ ** Bezier.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -20,7 +20,7 @@ #include <algorithm> #include <utility> -#include "Bezier.h" +#include "Bezier.hpp" using namespace std; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.hpp index d95794c27fe..a4f227c014f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** Bezier.h ** +** Bezier.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,12 +18,12 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_BEZIER_H -#define DVISVGM_BEZIER_H +#ifndef BEZIER_HPP +#define BEZIER_HPP #include <vector> -#include "BoundingBox.h" -#include "Pair.h" +#include "BoundingBox.hpp" +#include "Pair.hpp" class Bezier { diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp index 46902a2d567..d8a7efb39ee 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp @@ -2,7 +2,7 @@ ** BgColorSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -20,9 +20,9 @@ #include <config.h> #include <algorithm> -#include "BgColorSpecialHandler.h" -#include "ColorSpecialHandler.h" -#include "SpecialActions.h" +#include "BgColorSpecialHandler.hpp" +#include "ColorSpecialHandler.hpp" +#include "SpecialActions.hpp" using namespace std; @@ -37,7 +37,7 @@ void BgColorSpecialHandler::preprocess (const char*, std::istream &is, SpecialAc if (!_pageColors.empty() && _pageColors.back().first == pageno) _pageColors.back().second = color; else - _pageColors.push_back(PageColor(pageno, color)); + _pageColors.emplace_back(PageColor(pageno, color)); } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.hpp index b6af8147658..d83fb1c7ddc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** BgColorSpecialHandler.h ** +** BgColorSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,25 +18,25 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_BGCOLORSPECIALHANDLER_H -#define DVISVGM_BGCOLORSPECIALHANDLER_H +#ifndef BGCOLORSPECIALHANDLER_HPP +#define BGCOLORSPECIALHANDLER_HPP #include <vector> -#include "Color.h" -#include "SpecialHandler.h" +#include "Color.hpp" +#include "SpecialHandler.hpp" class BgColorSpecialHandler : public SpecialHandler, public DVIBeginPageListener { public: - void preprocess (const char *prefix, std::istream &is, SpecialActions &actions); - bool process (const char *prefix, std::istream &is, SpecialActions &actions); - const char* info () const {return "background color special";} - const char* name () const {return "bgcolor";} - const char** prefixes () const; + void preprocess (const char *prefix, std::istream &is, SpecialActions &actions) override; + bool process (const char *prefix, std::istream &is, SpecialActions &actions) override; + const char* info () const override {return "background color special";} + const char* name () const override {return "bgcolor";} + const char** prefixes () const override; protected: - void dviBeginPage (unsigned pageno, SpecialActions &actions); + void dviBeginPage (unsigned pageno, SpecialActions &actions) override; private: typedef std::pair<unsigned,Color> PageColor; // page number and color diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.cpp index ad8a915c318..40f5c1b5f8b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.cpp @@ -2,7 +2,7 @@ ** Bitmap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -22,8 +22,7 @@ #include <algorithm> #include <cstdlib> #include <limits> -#include "Bitmap.h" -#include "macros.h" +#include "Bitmap.hpp" using namespace std; @@ -50,8 +49,8 @@ void Bitmap::resize (int minx, int maxx, int miny , int maxy) { _yshift = miny; _bpr = _cols/8 + (_cols % 8 ? 1 : 0); // bytes per row _bytes.resize(_rows*_bpr); - FORALL(_bytes, vector<UInt8>::iterator, it) - *it = 0; + for (uint8_t &byte : _bytes) + byte = 0; } @@ -62,16 +61,16 @@ void Bitmap::resize (int minx, int maxx, int miny , int maxy) { void Bitmap::setBits (int row, int col, int n) { row -= _yshift; col -= _xshift; - UInt8 *byte = &_bytes[row*_bpr + col/8]; + uint8_t *byte = &_bytes[row*_bpr + col/8]; if (byte < &_bytes[0]) return; - const UInt8 *maxptr = &_bytes[0]+_bytes.size()-1; + const uint8_t *maxptr = &_bytes[0]+_bytes.size()-1; while (n > 0 && byte <= maxptr) { int b = 7 - col%8; // number of leftmost bit in current byte to be set int m = min(n, b+1); // number of bits to be set in current byte int bitseq = (1 << m)-1; // sequence of n set bits (bits 0..n-1 are set) bitseq <<= b-m+1; // move bit sequence so that bit b is the leftmost set bit - *byte |= UInt8(bitseq); // apply bit sequence to current byte + *byte |= uint8_t(bitseq); // apply bit sequence to current byte byte++; n -= m; col += m; @@ -82,7 +81,7 @@ void Bitmap::setBits (int row, int col, int n) { void Bitmap::forAllPixels (Callback &data) const { for (int row=0; row < _rows ; row++) { for (int col=0; col < _bpr; col++) { - UInt8 byte = _bytes[row*_bpr+col]; + uint8_t byte = _bytes[row*_bpr+col]; int x; for (int b=7; (b >= 0) && ((x = 8*col+(7-b)) < _cols); b--) data.pixel(x, row, bool(byte & (1 << b)), *this); @@ -102,7 +101,7 @@ class BBoxCallback : public Bitmap::Callback int maxy () const {return _maxy;} bool empty () const {return !_changed;} - void pixel (int x, int y, bool set, const Bitmap&) { + void pixel (int x, int y, bool set, const Bitmap&) override { if (set) { _minx = min(_minx, x); _miny = min(_miny, y); @@ -112,7 +111,7 @@ class BBoxCallback : public Bitmap::Callback } } - void finish () { + void finish () override { if (empty()) _minx = _miny = 0; } @@ -151,7 +150,7 @@ void Bitmap::getExtent (int &w, int &h) const { ostream& Bitmap::write (ostream &os) const { for (int r=_rows-1; r >= 0 ; r--) { for (int c=0; c < _bpr; c++) { - UInt8 byte = _bytes[r*_bpr+c]; + uint8_t byte = _bytes[r*_bpr+c]; for (int b=128; b; b>>=1) os << (byte & b ? '*' : '-'); os << ' '; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.hpp index c4e8e3d1a4b..30c29cf5f16 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** Bitmap.h ** +** Bitmap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,19 +18,18 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_BITMAP_H -#define DVISVGM_BITMAP_H +#ifndef BITMAP_HPP +#define BITMAP_HPP #include <ostream> #include <vector> -#include "types.h" class Bitmap { public: struct Callback { - virtual ~Callback() {} + virtual ~Callback() =default; virtual void pixel (int x, int y, bool set, Bitmap &bm) {} virtual void pixel (int x, int y, bool set, const Bitmap &bm) {} virtual void finish () {} @@ -41,7 +40,7 @@ class Bitmap Bitmap (int minx, int maxx, int miny , int maxy); void resize (int minx, int maxx, int miny , int maxy); void setBits(int row, int col, int n); - const UInt8* rowPtr (int row) const {return &_bytes[row*_bpr];} + const uint8_t* rowPtr (int row) const {return &_bytes[row*_bpr];} int height () const {return _rows;} int width () const {return _cols;} int xshift () const {return _xshift;} @@ -64,7 +63,7 @@ class Bitmap int _rows, _cols; ///< number of rows, columns int _xshift, _yshift; ///< horizontal/vertical shift int _bpr; ///< number of bytes per row - std::vector<UInt8> _bytes; + std::vector<uint8_t> _bytes; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp index f4fc6f7ca71..f45b17e966d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp @@ -2,7 +2,7 @@ ** BoundingBox.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -21,10 +21,11 @@ #include <config.h> #include <algorithm> #include <sstream> -#include "BoundingBox.h" -#include "Matrix.h" -#include "XMLNode.h" -#include "XMLString.h" +#include "BoundingBox.hpp" +#include "Matrix.hpp" +#include "utility.hpp" +#include "XMLNode.hpp" +#include "XMLString.hpp" using namespace std; @@ -66,27 +67,13 @@ BoundingBox::BoundingBox (const string &boxstr) } -/** Removes leading and trailing whitespace from the given string. */ -static string& strip (string &str) { - size_t n=0; - while (n < str.length() && isspace(str[n])) - ++n; - str.erase(0, n); - n=str.length()-1; - while (n > 0 && isspace(str[n])) - --n; - str.erase(n+1); - return str; -} - - /** Extracts a sequence of length values from a given string. * @param[in] boxstr whitespace and/or comma separated string of lengths. * @param[out] the extracted lengths */ void BoundingBox::extractLengths (string boxstr, vector<Length> &lengths) { const size_t len = boxstr.length(); size_t l=0; - strip(boxstr); + boxstr = util::trim(boxstr); string lenstr; do { while (l < len && isspace(boxstr[l])) @@ -96,7 +83,7 @@ void BoundingBox::extractLengths (string boxstr, vector<Length> &lengths) { r++; lenstr = boxstr.substr(l, r-l); if (!lenstr.empty()) { - lengths.push_back(Length(lenstr)); + lengths.emplace_back(Length(lenstr)); if (boxstr[r] == ',') r++; l = r; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp index 9d7dff1b888..963484ad9d0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** BoundingBox.h ** +** BoundingBox.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,17 +18,15 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_BOUNDINGBOX_H -#define DVISVGM_BOUNDINGBOX_H +#ifndef BOUNDINGBOX_HPP +#define BOUNDINGBOX_HPP #include <ostream> #include <string> #include <vector> -#include "Length.h" -#include "MessageException.h" -#include "Pair.h" -#include "macros.h" -#include "types.h" +#include "Length.hpp" +#include "MessageException.hpp" +#include "Pair.hpp" class Matrix; @@ -90,6 +88,9 @@ class BoundingBox bool _locked : 1; ///< if true, the box data is read-only }; -IMPLEMENT_OUTPUT_OPERATOR(BoundingBox) + +inline std::ostream& operator << (std::ostream &os, const BoundingBox &bbox) { + return bbox.write(os); +} #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.cpp new file mode 100644 index 00000000000..6cd0a87d573 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.cpp @@ -0,0 +1,233 @@ +/************************************************************************* +** CLCommandLine.cpp ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#include <algorithm> +#include <cstring> +#include <map> +#include "CLCommandLine.hpp" +#include "version.hpp" + +using namespace CL; +using namespace std; + + +CommandLine::CommandLine (const char *summary, const char *usage, const char *copyright) + : _summary(summary), _usage(usage), _copyright(copyright) +{ +} + + +void CommandLine::parse (int argc, char **argv) { + bool filesOnly = false; + for (int i=1; i < argc; i++) { + istringstream iss(argv[i]); + if (filesOnly || iss.peek() != '-') + _files.push_back(argv[i]); + else { + iss.get(); // skip dash + if (iss.peek() != '-') + parseShortOption(iss, argc, argv, i); + else { + iss.get(); // skip dash + if (iss.peek() == EOF) // "--" only, no following option name? + filesOnly = true; // treat all following options as filenames + else + parseLongOption(iss); + } + } + } +} + + +static void error (const Option &option, bool shortname, const string &msg) { + ostringstream oss; + oss << "option "; + if (shortname) + oss << '-' << option.shortName(); + else + oss << "--" << option.longName(); + oss << ": " << msg; + throw CommandLineException(oss.str()); +} + + +static void type_error (const Option &option, bool shortname) { + ostringstream oss; + switch (option.argMode()) { + case Option::ArgMode::NONE: + error(option, shortname, "no argument expected"); + break; + case Option::ArgMode::OPTIONAL: + oss << "optional argument "; + if (!option.argName().empty()) + oss << "'" << option.argName() << "' "; + oss << "must be of "+option.typeString()+" type"; + error(option, shortname, oss.str()); + break; + default: + oss << option.typeString()+" argument "; + if (!option.argName().empty()) + oss << "'" << option.argName() << "' "; + oss << "expected"; + error(option, shortname, oss.str()); + } +} + + +void CommandLine::parseShortOption (istringstream &iss, int argc, char **argv, int &argn) { + bool combined = false; + do { + char shortname = static_cast<char>(iss.get()); + if (!isalnum(shortname)) + throw CommandLineException(string("syntax error: -")+shortname); + if (Option *option = lookupOption(shortname)) { + if (!combined || option->argMode() == Option::ArgMode::NONE) { + if (option->argMode() == Option::ArgMode::REQUIRED && strlen(argv[argn]) == 2) { // required argument separated by whitespace? + if (argn+1 < argc && argv[argn+1][0] != '-') + iss.str(argv[++argn]); // continue parsing with next command-line field + } + if (!option->parse(iss, false)) + type_error(*option, true); + if (option->argMode() == Option::ArgMode::NONE) + combined = true; + } + else + throw CommandLineException(string("option -")+ shortname + " must be given separately"); + } + else + throw CommandLineException(string("unknown option -")+shortname); + } + while (combined && !iss.eof()); +} + + +void CommandLine::parseLongOption (istream &is) { + string optname; + while (isalnum(is.peek()) || (!optname.empty() && is.peek() == '-')) + optname += char(is.get()); + if (optname.empty()) + throw CommandLineException("unexpected character '" + string(1, is.peek()) + "' after '--'"); + vector<Option*> options = lookupOption(optname); + if (options.empty()) + throw CommandLineException("unknown option --"+optname); + else if (options.size() == 1) { + if (!options[0]->parse(is, true)) + type_error(*options[0], false); + } + else { // is partially given option ambiguous? + sort(options.begin(), options.end(), [](const Option *opt1, const Option *opt2) { + return opt1->longName() < opt2->longName(); + }); + string msg = "option --" + optname + " is ambiguous ("; + for (const Option *opt : options) { + if (opt != options[0]) + msg += ", "; + msg += opt->longName(); + } + msg += ')'; + throw CommandLineException(msg); + } +} + + +/** Returns all options that match the given long name. */ +vector<Option*> CommandLine::lookupOption (const string &optname) const { + vector<Option*> matches; + int len = optname.length(); + for (OptSectPair optsect : options()) { + if (optsect.first->longName() == optname) { // exact match? + matches.clear(); + matches.push_back(optsect.first); + break; + } + if (optsect.first->longName().substr(0, len) == optname) // partial match? + matches.push_back(optsect.first); + } + return matches; +} + + +/** Returns the option that match the given short name. */ +Option* CommandLine::lookupOption (char optchar) const { + auto it = find_if(options().begin(), options().end(), [=](const OptSectPair &optsect) { + return optsect.first->shortName() == optchar; + }); + return (it != options().end()) ? it->first : nullptr; +} + + +/** Prints help text including summary of options. + * @param[in] os output stream the help text is printed to + * @param[in] mode output mode (0=section, 1=sorted by short options, 2=sorted by long options) */ +void CommandLine::help (ostream &os, int mode) const { + os << PROGRAM_NAME << ' '<< PROGRAM_VERSION << "\n\n"; + os << _summary << "\n\n"; + // print usage info + size_t start=0, pos=0; + string usage = _usage; + while ((pos = usage.find('\n', start)) != string::npos || start < usage.length()) { + os << (start == 0 ? "Usage: " : " ") << PROGRAM_NAME << ' ' << usage.substr(start, pos) << '\n'; + start = (pos != string::npos ? pos+1 : string::npos); + } + if (mode > 0) + os << '\n'; + + // compute width of first column of help output + map<Option*, pair<string,string>> linecols; + size_t col1width=0; + for (const OptSectPair &ospair : options()) { + string line = ospair.first->helpline(); + if ((pos = line.find('\t')) != string::npos) { + linecols.emplace(ospair.first, pair<string,string>(line.substr(0, pos), line.substr(pos+1))); + col1width = max(col1width, pos); + } + } + if (mode > 0) { + bool (*isless)(const OptSectPair&, const OptSectPair&) = [](const OptSectPair &p1, const OptSectPair &p2) { + return p1.first->longName() < p2.first->longName(); + }; + if (mode == 1) { + isless = [](const OptSectPair &p1, const OptSectPair &p2) { + char c1 = p1.first->shortName(), c2 = p2.first->shortName(); + if (c1 == c2) + return p1.first->longName() < p2.first->longName(); + if (tolower(c1) == tolower(c2)) + return c1 > c2; // lower case before upper case letters + return tolower(c1) < tolower(c2); + }; + } + sort(options().begin(), options().end(), isless); + } + + // print summary of options + col1width += 2; + int sectno=-1; + for (const OptSectPair &ospair : options()) { + if (mode == 0 && ospair.second != sectno) { // first option in current section? + sectno = ospair.second; + if (section(sectno)) + os << '\n' << section(sectno) << ":\n"; + } + Option *opt = ospair.first; + os << " " << setw(col1width) << left << linecols[opt].first; + os << setw(0) << linecols[opt].second << '\n'; + } + os << '\n' << _copyright << '\n'; +}
\ No newline at end of file diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.hpp new file mode 100644 index 00000000000..549bfa80c32 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.hpp @@ -0,0 +1,67 @@ +/************************************************************************* +** CLCommandLine.hpp ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef CL_COMMANDLINE_HPP +#define CL_COMMANDLINE_HPP + +#include <array> +#include <ostream> +#include <string> +#include <sstream> +#include <vector> +#include "CLOption.hpp" +#include "MessageException.hpp" + +namespace CL { + +class CommandLine { + public: + CommandLine (const char *summary, const char *usage, const char *copyright); + virtual ~CommandLine () =default; + void parse (int argc, char **argv); + void help (std::ostream &os, int mode=0) const; + const std::vector<std::string>& filenames () const {return _files;} + + protected: + typedef std::pair<Option*,int> OptSectPair; + void parseShortOption (std::istringstream &is, int argc, char **argv, int &argn); + void parseLongOption (std::istream &is); + virtual std::vector<OptSectPair>& options () const =0; + virtual const char* section (size_t n) const {return nullptr;} + Option* lookupOption (char optchar) const; + std::vector<Option*> lookupOption (const std::string &optname) const; + + private: + const char *_summary; + const char *_usage; + const char *_copyright; + std::vector<std::string> _files; +}; + + +struct CommandLineException : public MessageException +{ + CommandLineException (const std::string &msg) : MessageException(msg) {} +}; + +} // namespace CL + +#endif + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CLOption.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CLOption.hpp new file mode 100644 index 00000000000..3e1efe84043 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CLOption.hpp @@ -0,0 +1,198 @@ +/************************************************************************* +** CLOption.hpp ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef CL_OPTION_HPP +#define CL_OPTION_HPP + +#include <iomanip> +#include <sstream> +#include <string> + +namespace CL { + +class Option +{ + friend class CommandLine; + public: + enum class ArgMode {NONE, OPTIONAL, REQUIRED}; + + public: + Option (const char *longname, char shortname, const char *summary) + : _shortName(shortname), _longName(longname), _summary(summary), _given(false) {} + + virtual ~Option () = default; + virtual std::string typeString () const {return "";} + virtual ArgMode argMode () const {return ArgMode::NONE;} + virtual bool given () const {return _given;} + virtual char shortName () const {return _shortName;} + virtual std::string longName () const {return _longName;} + virtual std::string summary () const {return _summary;} + virtual std::string argName () const {return "";} + virtual std::string valueString () const {return "";} + + virtual std::string helpline () const { + std::string line; + if (_shortName != '\0') + line = std::string("-") + _shortName + ", "; + else + line = " "; + line += "--" + std::string(_longName); + if (!argName().empty()) { + if (argMode() == ArgMode::OPTIONAL) + line += '['; + line += '='; + line += argName(); + if (argMode() == ArgMode::OPTIONAL) + line += ']'; + } + if (_summary) { + line += '\t'; + line += _summary; + } + if (argMode() != ArgMode::NONE && !valueString().empty()) + line += std::string(" [") + valueString() + "]"; + return line; + } + + protected: + virtual bool parse (std::istream &is, bool longopt) { + if (is.eof()) + return given(argMode() != ArgMode::REQUIRED); + if (argMode() == ArgMode::OPTIONAL && is.peek() == ' ') + return given(false); + if (longopt && is.get() != '=') + return given(false); + return given(parseValue(is)); + } + + virtual bool parseValue (std::istream &is) { + return is.peek() == EOF || argMode() == ArgMode::NONE; + } + + bool given (bool val) {return _given = val;} + + private: + char _shortName; + const char *_longName; + const char*_summary; + bool _given; +}; + + +template <typename T> +constexpr const char* typeString () {return "unknown";} + +template<> constexpr const char* typeString<bool> () {return "boolean";} +template<> constexpr const char* typeString<int> () {return "integer";} +template<> constexpr const char* typeString<unsigned> () {return "non-negative integer";} +template<> constexpr const char* typeString<double> () {return "floating point";} +template<> constexpr const char* typeString<std::string> () {return "string";} + +template <typename T> +inline T parseValue (std::istream &is) { + T value; + is >> value; + return value; +} + +template<> +inline std::string parseValue (std::istream &is) { + is >> std::ws; + std::string str; + std::getline(is, str); + return str; +} + + +template <typename T, Option::ArgMode mode> +class TypedOption : public Option +{ + public: + TypedOption (const char *longName, char shortName, const char *argName, T val, const char *summary) + : Option(longName, shortName, summary), _argName(argName), _value(val) {} + + TypedOption (const char *longName, char shortName, const char *argName, const char *summary) + : Option(longName, shortName, summary), _argName(argName), _value() {} + + T value () const {return _value;} + std::string typeString () const override {return CL::typeString<T>();} + std::string argName() const override {return _argName ? _argName : "";} + + std::string valueString () const override { + std::ostringstream oss; + oss << _value; + return oss.str(); + } + + ArgMode argMode () const override {return mode;} + + protected: + bool parseValue (std::istream &is) override { + T value = CL::parseValue<T>(is); + if (!is.fail()) + _value = std::move(value); + return !is.fail() || (argMode() == ArgMode::OPTIONAL && is.eof()); + } + + private: + const char *_argName; + T _value; +}; + + +template <Option::ArgMode mode> +class TypedOption<bool, mode> : public Option +{ + public: + TypedOption (const char *longName, char shortName, const char *argName, bool val, const char *summary) + : Option(longName, shortName, summary), _argName(argName), _value(val) {} + + TypedOption (const char *longName, char shortName, const char *argName, const char *summary) + : Option(longName, shortName, summary), _argName(argName), _value(false) {} + + bool value () const {return _value;} + std::string valueString () const override {return _value ? "yes" : "no";} + ArgMode argMode () const override {return mode;} + std::string typeString () const override {return CL::typeString<bool>();} + std::string argName() const override {return _argName ? _argName : "";} + + protected: + bool parseValue (std::istream &is) override { + std::string str; + is >> str; + if (is.fail()) + return argMode() != ArgMode::REQUIRED; + if (str == "yes" || str == "y" || str == "true" || str == "1") + _value = true; + else if (str == "no" || str == "n" || str == "false" || str == "0") + _value = false; + else + return false; + return true; + } + + private: + const char *_argName; + bool _value; +}; + +} // namespace CL + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.cpp index ba536de75d7..857d6b0947f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.cpp @@ -2,7 +2,7 @@ ** CMap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -21,15 +21,15 @@ #include <config.h> #include <algorithm> #include <sstream> -#include "CMap.h" -#include "CMapManager.h" -#include "FileFinder.h" +#include "CMap.hpp" +#include "CMapManager.hpp" +#include "FileFinder.hpp" using namespace std; const char* CMap::path () const { - return FileFinder::lookup(name(), "cmap", false); + return FileFinder::instance().lookup(name(), "cmap", false); } @@ -48,7 +48,7 @@ string SegmentedCMap::getROString() const { /** Returns the CID for a given character code. */ -UInt32 SegmentedCMap::cid (UInt32 c) const { +uint32_t SegmentedCMap::cid (uint32_t c) const { if (_cidranges.valueExists(c)) return _cidranges.valueAt(c); if (_basemap) @@ -58,7 +58,7 @@ UInt32 SegmentedCMap::cid (UInt32 c) const { /** Returns the character code of a base font for a given CID. */ -UInt32 SegmentedCMap::bfcode (UInt32 cid) const { +uint32_t SegmentedCMap::bfcode (uint32_t cid) const { if (_bfranges.valueExists(cid)) return _bfranges.valueAt(cid); if (_basemap) diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.hpp index c6a3e2c0c3b..31adbaac038 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** CMap.h ** +** CMap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,30 +18,29 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_CMAP_H -#define DVISVGM_CMAP_H +#ifndef CMAP_HPP +#define CMAP_HPP #include <algorithm> #include <ostream> #include <vector> -#include "FontEncoding.h" -#include "RangeMap.h" -#include "types.h" +#include "FontEncoding.hpp" +#include "RangeMap.hpp" struct CMap : public NamedFontEncoding { - virtual ~CMap () {} + virtual ~CMap () =default; virtual bool vertical () const =0; virtual bool mapsToCID () const =0; - virtual const char* path () const; - virtual UInt32 cid (UInt32 c) const =0; - virtual UInt32 bfcode (UInt32 cid) const =0; + virtual uint32_t cid (uint32_t c) const =0; + virtual uint32_t bfcode (uint32_t cid) const =0; virtual std::string getROString () const =0; - virtual const FontEncoding* findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const; - virtual bool mapsToCharIndex () const {return mapsToCID();} + const char* path () const override; + const FontEncoding* findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const override; + bool mapsToCharIndex () const override {return mapsToCID();} - Character decode (UInt32 c) const { + Character decode (uint32_t c) const override { if (mapsToCID()) return Character(Character::INDEX, cid(c)); return Character(Character::CHRCODE, bfcode(c)); @@ -51,36 +50,36 @@ struct CMap : public NamedFontEncoding struct IdentityCMap : public CMap { - UInt32 cid (UInt32 c) const {return c;} - UInt32 bfcode (UInt32 cid) const {return 0;} - std::string getROString () const {return "Adobe-Identity";} - bool mapsToCID() const {return true;} + uint32_t cid (uint32_t c) const override {return c;} + uint32_t bfcode (uint32_t cid) const override {return 0;} + std::string getROString () const override {return "Adobe-Identity";} + bool mapsToCID() const override {return true;} }; struct IdentityHCMap : public IdentityCMap { - bool vertical () const {return false;} - const char* name () const {return "Identity-H";} + bool vertical () const override {return false;} + const char* name () const override {return "Identity-H";} }; struct IdentityVCMap : public IdentityCMap { - bool vertical () const {return true;} - const char* name () const {return "Identity-V";} + bool vertical () const override {return true;} + const char* name () const override {return "Identity-V";} }; struct UnicodeCMap : public CMap { - bool vertical () const {return false;} - const char* name () const {return "unicode";} - bool mapsToCID () const {return false;} - const char* path () const {return 0;} - UInt32 cid (UInt32 c) const {return c;} - UInt32 bfcode (UInt32 cid) const {return cid;} - std::string getROString () const {return "";} + bool vertical () const override {return false;} + const char* name () const override {return "unicode";} + bool mapsToCID () const override {return false;} + const char* path () const override {return 0;} + uint32_t cid (uint32_t c) const override {return c;} + uint32_t bfcode (uint32_t cid) const override {return cid;} + std::string getROString () const override {return "";} }; @@ -90,17 +89,17 @@ class SegmentedCMap : public CMap public: SegmentedCMap (const std::string &fname) : _filename(fname), _basemap(0), _vertical(false), _mapsToCID(true) {} - const char* name () const {return _filename.c_str();} - UInt32 cid (UInt32 c) const; - UInt32 bfcode (UInt32 cid) const; - void addCIDRange (UInt32 first, UInt32 last, UInt32 cid) {_cidranges.addRange(first, last, cid);} - void addBFRange (UInt32 first, UInt32 last, UInt32 chrcode) {_bfranges.addRange(first, last, chrcode);} + const char* name () const override {return _filename.c_str();} + uint32_t cid (uint32_t c) const override; + uint32_t bfcode (uint32_t cid) const override; + void addCIDRange (uint32_t first, uint32_t last, uint32_t cid) {_cidranges.addRange(first, last, cid);} + void addBFRange (uint32_t first, uint32_t last, uint32_t chrcode) {_bfranges.addRange(first, last, chrcode);} void write (std::ostream &os) const; - bool vertical () const {return _vertical;} - bool mapsToCID () const {return _mapsToCID;} - size_t numCIDRanges () const {return _cidranges.size();} - size_t numBFRanges () const {return _bfranges.size();} - std::string getROString () const; + bool vertical () const override {return _vertical;} + bool mapsToCID () const override {return _mapsToCID;} + size_t numCIDRanges () const {return _cidranges.size();} + size_t numBFRanges () const {return _bfranges.size();} + std::string getROString () const override; private: std::string _filename; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.cpp index b10e7c0c9da..5881a8f8af6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.cpp @@ -2,7 +2,7 @@ ** CMapManager.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -20,22 +20,16 @@ #include <config.h> #include <sstream> -#include "CMap.h" -#include "CMapManager.h" -#include "CMapReader.h" -#include "FileFinder.h" -#include "Font.h" -#include "Message.h" +#include "CMap.hpp" +#include "CMapManager.hpp" +#include "CMapReader.hpp" +#include "FileFinder.hpp" +#include "Font.hpp" +#include "Message.hpp" using namespace std; -CMapManager::~CMapManager () { - for (CMaps::iterator it=_cmaps.begin(); it != _cmaps.end(); ++it) - delete it->second; -} - - CMapManager& CMapManager::instance () { static CMapManager cmm; return cmm; @@ -46,7 +40,7 @@ CMapManager& CMapManager::instance () { CMap* CMapManager::lookup (const string &name) { CMaps::iterator it = _cmaps.find(name); if (it != _cmaps.end()) - return it->second; + return it->second.get(); if (_includedCMaps.find(name) != _includedCMaps.end()) { _level = 0; @@ -63,7 +57,7 @@ CMap* CMapManager::lookup (const string &name) { else if (name == "unicode") cmap = new UnicodeCMap; if (cmap) { - _cmaps[name] = cmap; + _cmaps[name].reset(cmap); return cmap; } // Load cmap data of file <name> and also process all cmaps referenced by operator "usecmap". @@ -78,7 +72,7 @@ CMap* CMapManager::lookup (const string &name) { _level = 1; Message::wstream(true) << "CMap file '" << name << "' not found\n"; } - _cmaps[name] = cmap; + _cmaps[name].reset(cmap); } catch (const CMapReaderException &e) { Message::estream(true) << "CMap file " << name << ": " << e.what() << "\n"; @@ -130,7 +124,7 @@ const CMap* CMapManager::findCompatibleBaseFontMap (const PhysicalFont *font, co for (size_t i=0; i < charmapIDs.size(); i++) { if (enc->id == charmapIDs[i]) { string cmapname = ro+"-"+enc->encname; - if (is_unicode_map || FileFinder::lookup(cmapname, "cmap", false)) { + if (is_unicode_map || FileFinder::instance().lookup(cmapname, "cmap", false)) { charmapID = enc->id; return is_unicode_map ? cmap : lookup(cmapname); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.hpp index 8b226a47a9c..994d5dc2155 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** CMapManager.h ** +** CMapManager.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,13 +18,14 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_CMAPMANAGER_H -#define DVISVGM_CMAPMANAGER_H +#ifndef CMAPMANAGER_HPP +#define CMAPMANAGER_HPP #include <map> +#include <memory> #include <set> #include <string> -#include "CharMapID.h" +#include "CharMapID.hpp" struct CMap; struct FontEncoding; @@ -33,9 +34,8 @@ class PhysicalFont; class CMapManager { - typedef std::map<std::string, CMap*> CMaps; + typedef std::map<std::string, std::unique_ptr<CMap>> CMaps; public: - ~CMapManager (); CMap* lookup (const std::string &name); const CMap* findCompatibleBaseFontMap (const PhysicalFont *font, const CMap *cmap, CharMapID &charmapID); static CMapManager& instance (); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.cpp index e9c49c573b6..0006da83fdd 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.cpp @@ -2,7 +2,7 @@ ** CMapReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,13 +19,15 @@ *************************************************************************/ #include <config.h> +#include <algorithm> +#include <array> #include <fstream> #include <sstream> -#include "CMap.h" -#include "CMapManager.h" -#include "CMapReader.h" -#include "FileFinder.h" -#include "InputReader.h" +#include "CMap.hpp" +#include "CMapManager.hpp" +#include "CMapReader.hpp" +#include "FileFinder.hpp" +#include "InputReader.hpp" using namespace std; @@ -39,7 +41,7 @@ CMapReader::CMapReader () : _cmap(0), _inCMap(false) * @param fname[in] name/path of cmap file * @return CMap object representing the read data, or 0 if file could not be read */ CMap* CMapReader::read (const string &fname) { - if (const char *path = FileFinder::lookup(fname.c_str(), "cmap", false)) { + if (const char *path = FileFinder::instance().lookup(fname.c_str(), "cmap", false)) { ifstream ifs(path); if (ifs) return read(ifs, fname); @@ -60,15 +62,15 @@ CMap* CMapReader::read (std::istream& is, const string &name) { try { while (ir) { Token token(ir); - if (token.type() == Token::TT_EOF) + if (token.type() == Token::Type::END) break; if (_inCMap) { - if (token.type() == Token::TT_OPERATOR) + if (token.type() == Token::Type::OPERATOR) executeOperator(token.strvalue(), ir); else _tokens.push_back(token); } - else if (token.type() == Token::TT_OPERATOR && token.strvalue() == "begincmap") + else if (token.type() == Token::Type::OPERATOR && token.strvalue() == "begincmap") _inCMap = true; } } @@ -81,25 +83,27 @@ CMap* CMapReader::read (std::istream& is, const string &name) { } -void CMapReader::executeOperator (const string &op, InputReader &ir) { - const struct Operator { +/** Executes a PS operator from the CMap file. + * @param[in] opname name of operator to execute + * @param[in] ir reader object used to read the CMap stream */ +void CMapReader::executeOperator (const string &opname, InputReader &ir) { + struct Operator { const char *name; void (CMapReader::*handler)(InputReader&); - } operators[] = { + }; + array<Operator, 6> operators = {{ {"beginbfchar", &CMapReader::op_beginbfchar}, {"beginbfrange", &CMapReader::op_beginbfrange}, {"begincidrange", &CMapReader::op_begincidrange}, {"def", &CMapReader::op_def}, {"endcmap", &CMapReader::op_endcmap}, {"usecmap", &CMapReader::op_usecmap}, - }; - - for (size_t i=0; i < sizeof(operators)/sizeof(Operator); i++) { - if (operators[i].name == op) { - (this->*operators[i].handler)(ir); - break; - } - } + }}; + auto it = find_if(operators.begin(), operators.end(), [&](const Operator &op) { + return op.name == opname; + }); + if (it != operators.end()) + (this->*it->handler)(ir); _tokens.clear(); } @@ -139,7 +143,7 @@ void CMapReader::op_usecmap (InputReader &) { } -static UInt32 parse_hexentry (InputReader &ir) { +static uint32_t parse_hexentry (InputReader &ir) { ir.skipSpace(); if (ir.get() != '<') throw CMapReaderException("invalid range entry ('<' expected)"); @@ -148,18 +152,18 @@ static UInt32 parse_hexentry (InputReader &ir) { throw CMapReaderException("invalid range entry (hexadecimal value expected)"); if (ir.get() != '>') throw CMapReaderException("invalid range entry ('>' expected)"); - return UInt32(val); + return uint32_t(val); } void CMapReader::op_begincidrange (InputReader &ir) { - if (!_tokens.empty() && _tokens.back().type() == Token::TT_NUMBER) { + if (!_tokens.empty() && _tokens.back().type() == Token::Type::NUMBER) { ir.skipSpace(); int num_entries = static_cast<int>(popToken().numvalue()); while (num_entries > 0 && ir.peek() == '<') { - UInt32 first = parse_hexentry(ir); - UInt32 last = parse_hexentry(ir); - UInt32 cid; + uint32_t first = parse_hexentry(ir); + uint32_t last = parse_hexentry(ir); + uint32_t cid; ir.skipSpace(); if (!ir.parseUInt(cid)) throw CMapReaderException("invalid range entry (decimal value expected)"); @@ -171,13 +175,13 @@ void CMapReader::op_begincidrange (InputReader &ir) { void CMapReader::op_beginbfrange (InputReader &ir) { - if (!_tokens.empty() && _tokens.back().type() == Token::TT_NUMBER) { + if (!_tokens.empty() && _tokens.back().type() == Token::Type::NUMBER) { ir.skipSpace(); int num_entries = static_cast<int>(popToken().numvalue()); while (num_entries > 0 && ir.peek() == '<') { - UInt32 first = parse_hexentry(ir); - UInt32 last = parse_hexentry(ir); - UInt32 chrcode = parse_hexentry(ir); + uint32_t first = parse_hexentry(ir); + uint32_t last = parse_hexentry(ir); + uint32_t chrcode = parse_hexentry(ir); _cmap->addBFRange(first, last, chrcode); ir.skipSpace(); } @@ -187,15 +191,15 @@ void CMapReader::op_beginbfrange (InputReader &ir) { void CMapReader::op_beginbfchar (InputReader &ir) { - if (!_tokens.empty() && _tokens.back().type() == Token::TT_NUMBER) { + if (!_tokens.empty() && _tokens.back().type() == Token::Type::NUMBER) { ir.skipSpace(); int num_entries = static_cast<int>(popToken().numvalue()); while (num_entries > 0 && ir.peek() == '<') { - UInt32 cid = parse_hexentry(ir); + uint32_t cid = parse_hexentry(ir); ir.skipSpace(); if (ir.peek() == '/') throw CMapReaderException("mapping of named characters is not supported"); - UInt32 chrcode = parse_hexentry(ir); + uint32_t chrcode = parse_hexentry(ir); _cmap->addBFRange(cid, cid, chrcode); ir.skipSpace(); } @@ -220,12 +224,12 @@ void CMapReader::Token::scan (InputReader &ir) { } ir.skipSpace(); if (ir.eof()) - _type = TT_EOF; + _type = Type::END; else if (ir.peek() == '/') { // PS name? ir.get(); while (!strchr("[]{}<>", ir.peek()) && !isspace(ir.peek())) _value += ir.get(); - _type = TT_NAME; + _type = Type::NAME; } else if (ir.peek() == '(') { // string? ir.get(); @@ -238,11 +242,11 @@ void CMapReader::Token::scan (InputReader &ir) { _value += ir.get(); } ir.get(); // skip ')' - _type = TT_STRING; + _type = Type::STRING; } else if (strchr("[]{}<>", ir.peek())) { // PS delimiter _value = ir.get(); - _type = TT_DELIM; + _type = Type::DELIM; } else if (isdigit(ir.peek())) { // number? double val; @@ -250,12 +254,12 @@ void CMapReader::Token::scan (InputReader &ir) { ostringstream oss; oss << val; _value = oss.str(); - _type = TT_NUMBER; + _type = Type::NUMBER; } } else { while (!strchr("[]{}<>", ir.peek()) && !isspace(ir.peek())) _value += ir.get(); - _type = TT_OPERATOR; + _type = Type::OPERATOR; } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.hpp index dc993fa8f6c..7c6662d2b17 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** CMapReader.h ** +** CMapReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,14 +18,14 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_CMAPREADER_H -#define DVISVGM_CMAPREADER_H +#ifndef CMAPREADER_HPP +#define CMAPREADER_HPP #include <cstdlib> #include <istream> #include <string> #include <vector> -#include "MessageException.h" +#include "MessageException.hpp" struct CMap; @@ -36,7 +36,7 @@ class CMapReader class Token { public: - enum Type {TT_UNKNOWN, TT_EOF, TT_DELIM, TT_NUMBER, TT_STRING, TT_NAME, TT_OPERATOR}; + enum class Type {UNKNOWN, END, DELIM, NUMBER, STRING, NAME, OPERATOR}; public: Token (InputReader &ir); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CRC32.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CRC32.cpp index 8b9eb9e4a95..1a4b56eb740 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CRC32.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CRC32.cpp @@ -2,7 +2,7 @@ ** CRC32.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -20,16 +20,16 @@ #include <config.h> #include <cstring> -#include "CRC32.h" +#include "CRC32.hpp" using namespace std; CRC32::CRC32 () : _crc32(0xFFFFFFFF) { - const UInt32 poly = 0xEDB88320; + const uint32_t poly = 0xEDB88320; for (int i = 0; i < 256; i++) { - UInt32 crc=i; + uint32_t crc=i; for (int j=8; j > 0; j--) { if (crc & 1) crc = (crc >> 1) ^ poly; @@ -50,16 +50,16 @@ void CRC32::reset () { /** Appends string bytes to the previous data and computes the resulting checksum. * @param[in] data string to update the checksum with */ void CRC32::update (const char *data) { - update((const UInt8*)data, strlen(data)); + update((const uint8_t*)data, strlen(data)); } /** Appends a single value to the previous data and computes the resulting checksum. * @param[in] n value to update the checksum with * @param[in] bytes number of bytes to consider (0-4) */ -void CRC32::update (UInt32 n, int bytes) { +void CRC32::update (uint32_t n, int bytes) { for (int i=bytes-1; i >= 0; --i) { - UInt8 byte = UInt8((n >> (8*i)) & 0xff); + uint8_t byte = uint8_t((n >> (8*i)) & 0xff); update(&byte, 1); } } @@ -68,7 +68,7 @@ void CRC32::update (UInt32 n, int bytes) { /** Appends a sequence of bytes to the previous data and computes the resulting checksum. * @param[in] bytes pointer to array of bytes * @param[in] len number of bytes in array */ -void CRC32::update (const UInt8 *bytes, size_t len) { +void CRC32::update (const uint8_t *bytes, size_t len) { for (size_t i=0; i < len; ++i) _crc32 = ((_crc32 >> 8) & 0x00FFFFFF) ^ _tab[(_crc32 ^ *bytes++) & 0xFF]; } @@ -78,13 +78,13 @@ void CRC32::update (istream &is) { char buf [4096]; while (is) { is.read(buf, 4096); - update((UInt8*)buf, is.gcount()); + update((uint8_t*)buf, is.gcount()); } } /** Returns the checksum computed from values added with the update functions. */ -UInt32 CRC32::get () const { +uint32_t CRC32::get () const { return _crc32 ^ 0xFFFFFFFF; } @@ -93,7 +93,7 @@ UInt32 CRC32::get () const { * @param[in] bytes pointer to array of bytes * @param[in] len number of bytes in array * @return CRC32 checksum */ -UInt32 CRC32::compute (const UInt8 *bytes, size_t len) { +uint32_t CRC32::compute (const uint8_t *bytes, size_t len) { CRC32 crc32; crc32.update(bytes, len); return crc32.get(); @@ -101,12 +101,12 @@ UInt32 CRC32::compute (const UInt8 *bytes, size_t len) { /** Computes the CRC32 checksum of a string. */ -UInt32 CRC32::compute (const char *str) { - return compute((const UInt8*)str, strlen(str)); +uint32_t CRC32::compute (const char *str) { + return compute((const uint8_t*)str, strlen(str)); } -UInt32 CRC32::compute (istream &is) { +uint32_t CRC32::compute (istream &is) { CRC32 crc32; crc32.update(is); return crc32.get(); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CRC32.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/CRC32.hpp index 77853e1bff4..f91de71a41b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CRC32.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CRC32.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** CRC32.h ** +** CRC32.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,33 +18,32 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef CRC32_H -#define CRC32_H +#ifndef CRC32_HPP +#define CRC32_HPP #include <cstdlib> #include <istream> -#include "types.h" class CRC32 { public: CRC32 (); - void update (const UInt8 *bytes, size_t len); - void update (UInt32 n, int bytes=4); + void update (const uint8_t *bytes, size_t len); + void update (uint32_t n, int bytes=4); void update (const char *str); void update (std::istream &is); - UInt32 get () const; + uint32_t get () const; void reset (); - static UInt32 compute (const UInt8 *bytes, size_t len); - static UInt32 compute (const char *str); - static UInt32 compute (std::istream &is); + static uint32_t compute (const uint8_t *bytes, size_t len); + static uint32_t compute (const char *str); + static uint32_t compute (std::istream &is); protected: CRC32 (const CRC32 &crc32) {} private: - UInt32 _crc32; - UInt32 _tab[256]; + uint32_t _crc32; + uint32_t _tab[256]; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.cpp index 2aad6ec7e1a..2baadcf9ec8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.cpp @@ -2,7 +2,7 @@ ** Calculator.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -21,7 +21,7 @@ #include <config.h> #include <cmath> #include <sstream> -#include "Calculator.h" +#include "Calculator.hpp" using namespace std; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.hpp index 7930e63a76c..2c117bb0456 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** Calculator.h ** +** Calculator.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,13 +18,13 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_CALCULATOR_H -#define DVISVGM_CALCULATOR_H +#ifndef CALCULATOR_HPP +#define CALCULATOR_HPP #include <istream> #include <map> #include <string> -#include "MessageException.h" +#include "MessageException.hpp" struct CalculatorException : public MessageException diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.cpp index 98040c8be14..5084081d0c9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.cpp @@ -2,7 +2,7 @@ ** CharMapID.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,7 +18,7 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#include "CharMapID.h" +#include "CharMapID.hpp" const CharMapID CharMapID::NONE(0, 0); const CharMapID CharMapID::WIN_SYMBOL(3, 0); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.hpp index 19f3d893463..ca1d47be9b7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** CharMapID.h ** +** CharMapID.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,15 +18,15 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_CHARMAPID_H -#define DVISVGM_CHARMAPID_H +#ifndef CHARMAPID_HPP +#define CHARMAPID_HPP -#include "types.h" +#include <cstdint> /** Represents a character map of a font. */ struct CharMapID { CharMapID () : platform_id(0), encoding_id(0) {} - CharMapID (UInt8 plf_id, UInt8 enc_id) : platform_id(plf_id), encoding_id(enc_id) {} + CharMapID (uint8_t plf_id, uint8_t enc_id) : platform_id(plf_id), encoding_id(enc_id) {} bool operator == (const CharMapID &ids) const { return platform_id == ids.platform_id && encoding_id == ids.encoding_id; @@ -52,8 +52,8 @@ struct CharMapID { static const CharMapID MAC_SIMPLCHINESE; static const CharMapID MAC_KOREAN; - UInt8 platform_id; - UInt8 encoding_id; + uint8_t platform_id; + uint8_t encoding_id; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Character.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Character.hpp index da55476c5c3..ebb4c3476cb 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Character.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Character.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** Character.h ** +** Character.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,26 +18,25 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_CHARACTER_H -#define DVISVGM_CHARACTER_H +#ifndef CHARACTER_HPP +#define CHARACTER_HPP -#include "types.h" class Character { public: enum Type {CHRCODE, INDEX, NAME}; Character (const char *name) : _type(NAME), _name(name) {} - Character (Type type, UInt32 val) : _type(type), _number(val) {} + Character (Type type, uint32_t val) : _type(type), _number(val) {} Character (Type type, const Character &c) : _type(type), _number(c.type() != NAME ? c._number : 0) {} Type type () const {return _type;} - const char* name () const {return _name;} - UInt32 number () const {return _number;} + const char* name () const {return _name;} + uint32_t number () const {return _number;} private: Type _type; union { - UInt32 _number; + uint32_t _number; const char *_name; }; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CmdLineParserBase.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CmdLineParserBase.cpp deleted file mode 100644 index e6d11c102a4..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CmdLineParserBase.cpp +++ /dev/null @@ -1,381 +0,0 @@ -/************************************************************************* -** CmdLineParserBase.cpp ** -** ** -** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** published by the Free Software Foundation; either version 3 of ** -** the License, or (at your option) any later version. ** -** ** -** This program is distributed in the hope that it will be useful, but ** -** WITHOUT ANY WARRANTY; without even the implied warranty of ** -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** -** GNU General Public License for more details. ** -** ** -** You should have received a copy of the GNU General Public License ** -** along with this program; if not, see <http://www.gnu.org/licenses/>. ** -*************************************************************************/ - -#include <config.h> -#include <algorithm> -#include <cstdio> -#include <cstring> -#include "CmdLineParserBase.h" -#include "InputBuffer.h" -#include "InputReader.h" -#include "Message.h" - -using namespace std; - -void CmdLineParserBase::init () { - _error = false; - _files.clear(); -} - - -/** Parses all options given on the command line. - * @param[in] argc number of command-line arguments - * @param[in] argv array providing the command-line arguments - * @param[in] printErrors enable/disable printing of error messages */ -void CmdLineParserBase::parse (int argc, char **argv, bool printErrors) { - init(); - _printErrors = printErrors; - bool filesOnly = false; // - for (int i=1; i < argc; i++) { - CharInputBuffer ib(argv[i], strlen(argv[i])); - BufferInputReader ir(ib); - if (filesOnly || ir.peek() != '-') - _files.push_back(argv[i]); - else { - ir.get(); - if (ir.peek() == '-') { - // scan long option - ir.get(); - if (ir.eof()) // "--" only - filesOnly = true; // treat all following options as filenames - else { - string longname; - while (isalnum(ir.peek()) || ir.peek() == '-') - longname += char(ir.get()); - if (const Option *opt = option(longname)) - (*opt->handler)(this, ir, *opt, true); - else if (!_error) { - if (printErrors) - Message::estream(false) << "unknown option --" << longname << '\n'; - _error = true; - } - } - } - else { - // scan short option(s) - bool combined = false; // multiple short options combined, e.g -abc - do { - int shortname = ir.get(); - if (const Option *opt = option(shortname)) { - if (!combined || opt->argmode == ARG_NONE) { - if (opt->argmode == ARG_REQUIRED && strlen(argv[i]) == 2) { // required argument separated by whitespace? - if (i+1 < argc && argv[i+1][0] != '-') - ib.assign(argv[++i]); - } - (*opt->handler)(this, ir, *opt, false); - if (opt->argmode == ARG_NONE) - combined = true; - } - else { - if (printErrors) - Message::estream(false) << "option -" << char(shortname) << " must be given separately\n"; - _error = true; - } - } - else if (shortname > 0) { - if (printErrors) - Message::estream(false) << "unknown option -" << char(shortname) << '\n'; - _error = true; - } - } - while (!_error && combined && !ir.eof()); - } - } - } -} - - -/** Prints an error message to stdout. - * @param[in] opt error occurred in this option - * @param[in] longopt the long option name was scanned - * @param[in] msg message to be printed */ -void CmdLineParserBase::error (const Option &opt, bool longopt, const char *msg) const { - if (_printErrors) { - Message::estream(false) << "option "; - if (longopt) - Message::estream(false) << "--" << opt.longname; - else - Message::estream(false) << '-' << opt.shortname; - Message::estream(false) << ": " << msg << '\n'; - } - _error = true; -} - - -#if 0 -#include <iostream> - -/** Lists the scanned filenames. Just for debugging purposes. */ -void CmdLineParserBase::status () const { - cout << "file names:\n"; - for (size_t i=0; i < _files.size(); i++) - cout << " " << _files[i] << endl; - cout << endl; -} -#endif - - -/** Returns the option information of a given short option name. - * If the option name can't be found 0 is returned. - * @param[in] shortname short version of the option without leading hyphen (e.g. p, not -p) */ -const CmdLineParserBase::Option* CmdLineParserBase::option (char shortname) const { - size_t numopts; // number of available options - for (const Option *opts = options(&numopts); numopts > 0; ++opts) { - if (opts->shortname == shortname) - return opts; - numopts--; - } - return 0; -} - - -/** Returns the option information of a given long option name. - * Parameter 'longname' hasn't to be the complete long option name. The function looks up - * all options that start with 'longname'. If a unique or an exact match was found, it's returned. - * Otherwise, the return value is 0. - * @param[in] longname long version of the option without leading hyphens (e.g. param, not --param) */ -const CmdLineParserBase::Option* CmdLineParserBase::option (const string &longname) const { - vector<const Option*> matches; // all matching options - size_t len = longname.length(); - size_t numopts; // number of available options - for (const Option *opts = options(&numopts); numopts > 0; ++opts) { - if (string(opts->longname, len) == longname) { - if (len == strlen(opts->longname)) // exact match? - return opts; - matches.push_back(opts); - } - numopts--; - } - switch (matches.size()) { - default: - if (_printErrors) { - Message::estream(false) << "option --" << longname << " is ambiguous ("; - for (size_t i=0; i < matches.size(); i++) { - if (i > 0) - Message::estream(false) << ", "; - Message::estream(false) << matches[i]->longname; - } - Message::estream(false) << ")\n"; - } - _error = true; - - case 0 : return 0; - case 1 : return matches[0]; - } -} - - -/** Returns true if a valid separator between option and argument was found. - * Arguments of long options are preceded by a '='. The argument of a short option - * directly follows the option without a separation character. - * @param[in] ir argument is read from this InputReader - * @param[in] opt scans argument of this option - * @param[in] longopt true if the long option name was given */ -bool CmdLineParserBase::checkArgPrefix (InputReader &ir, const Option &opt, bool longopt) const { - if (longopt) { - if (ir.peek() == '=') - ir.get(); - else { - error(opt, longopt, "'=' expected"); - return false; - } - } - return true; -} - - -/** Returns true if a given option has no argument, .e.g. -p or --param. - * @param[in] ir argument is read from this InputReader - * @param[in] opt scans argument of this option - * @param[in] longopt true if the long option name was given */ -bool CmdLineParserBase::checkNoArg (InputReader &ir, const Option &opt, bool longopt) const { - if (ir.eof()) - return true; - error(opt, longopt, "no argument expected"); - return false; -} - - -/** Gets an integer argument of a given option, e.g. -p5 or --param=5. - * @param[in] ir argument is read from this InputReader - * @param[in] opt scans argument of this option - * @param[in] longopt true if the long option name was given - * @param[out] arg the scanned option argument - * @return true if argument could be scanned without errors */ -bool CmdLineParserBase::getIntArg (InputReader &ir, const Option &opt, bool longopt, int &arg) const { - if (checkArgPrefix(ir, opt, longopt)) { - if (ir.parseInt(arg) && ir.eof()) - return true; - error(opt, longopt, "integer value expected"); - } - return false; -} - - -/** Gets an unsigned integer argument of a given option, e.g. -p5 or --param=5. - * @param[in] ir argument is read from this InputReader - * @param[in] opt scans argument of this option - * @param[in] longopt true if the long option name was given - * @param[out] arg the scanned option argument - * @return true if argument could be scanned without errors */ -bool CmdLineParserBase::getUIntArg (InputReader &ir, const Option &opt, bool longopt, unsigned &arg) const { - if (checkArgPrefix(ir, opt, longopt)) { - if (ir.parseUInt(arg) && ir.eof()) - return true; - error(opt, longopt, "unsigned integer value expected"); - } - return false; -} - - -/** Gets a double (floating point) argument of a given option, e.g. -p2.5 or --param=2.5. - * @param[in] ir argument is read from this InputReader - * @param[in] opt scans argument of this option - * @param[in] longopt true if the long option name was given - * @param[out] arg the scanned option argument - * @return true if argument could be scanned without errors */ -bool CmdLineParserBase::getDoubleArg (InputReader &ir, const Option &opt, bool longopt, double &arg) const { - if (checkArgPrefix(ir, opt, longopt)) { - if (ir.parseDouble(arg) != 0 && ir.eof()) - return true; - error(opt, longopt, "floating point value expected"); - } - return false; -} - - -/** Gets a string argument of a given option, e.g. -pstr or --param=str. - * @param[in] ir argument is read from this InputReader - * @param[in] opt scans argument of this option - * @param[in] longopt true if the long option name was given - * @param[out] arg the scanned option argument - * @return true if argument could be scanned without errors */ -bool CmdLineParserBase::getStringArg (InputReader &ir, const Option &opt, bool longopt, string &arg) const { - if (checkArgPrefix(ir, opt, longopt)) { - arg.clear(); - while (!ir.eof()) - arg += char(ir.get()); - if (!arg.empty()) - return true; - error(opt, longopt, "string argument expected"); - } - return false; -} - - -/** Gets a boolean argument of a given option, e.g. -pyes or --param=yes. - * @param[in] ir argument is read from this InputReader - * @param[in] opt scans argument of this option - * @param[in] longopt true if the long option name was given - * @param[out] arg the scanned option argument - * @return true if argument could be scanned without errors */ -bool CmdLineParserBase::getBoolArg (InputReader &ir, const Option &opt, bool longopt, bool &arg) const { - if (checkArgPrefix(ir, opt, longopt)) { - string str; - while (!ir.eof()) - str += char(ir.get()); - if (str == "yes" || str == "y" || str == "true" || str == "1") { - arg = true; - return true; - } - else if (str == "no" || str == "n" || str == "false" || str == "0") { - arg = false; - return true; - } - error(opt, longopt, "boolean argument expected (yes, no, true, false, 0, 1)"); - } - return false; -} - - -/** Gets a (single) character argument of a given option, e.g. -pc or --param=c. - * @param[in] ir argument is read from this InputReader - * @param[in] opt scans argument of this option - * @param[in] longopt true if the long option name was given - * @param[out] arg the scanned option argument - * @return true if argument could be scanned without errors */ -bool CmdLineParserBase::getCharArg (InputReader &ir, const Option &opt, bool longopt, char &arg) const { - if (checkArgPrefix(ir, opt, longopt)) { - arg = char(ir.get()); - if (arg >= 0 && ir.eof()) - return true; - error(opt, longopt, "character argument expected"); - } - return false; -} - - -/** Compares the short option characters of two help lines. - * @return true if line1 should appear before line2 */ -static bool cmp_short (const char *line1, const char *line2) { - if (*line1 != 'o' || *line2 != 'o' || (line1[1] == ' ' && line2[1] == ' ')) - return strcmp(line1, line2) < 0; - char lopt1 = tolower(line1[2]); - char lopt2 = tolower(line2[2]); - if (lopt1 == lopt2) // same character but different case? - return line1[2] > line2[2]; // line with lower-case letter first - return lopt1 < lopt2; -} - - -/** Compares the long option names of two help lines. - * @return true if line1 should appear before line2 */ -static bool cmp_long (const char *line1, const char *line2) { - if (*line1 != 'o' || *line2 != 'o') - return strcmp(line1, line2) < 0; - return strcmp(line1+6, line2+6) < 0; -} - - -static void write_line (const char *str) { - fputs(str, stdout); -} - - -/** Prints the help text to stdout. - * @param[in] mode format of help text */ -void CmdLineParserBase::help (int mode, void (*out)(const char*)) const { - size_t numlines; - const char **lines = helplines(&numlines); - if (out == 0) - out = write_line; - if (mode == 0) { // list options with section headers - for (size_t i=0; i < numlines; i++) { - switch (*lines[i]) { - case 's': out("\n"); break; // section header - case 'o': out(" "); break; // option info - } - out(lines[i]+1); - out("\n"); - } - } - else { - vector<const char*> linevec(lines, lines+numlines); - sort(linevec.begin(), linevec.end(), mode == 1 ? cmp_short : cmp_long); - for (vector<const char*>::iterator it=linevec.begin(); it != linevec.end(); ++it) { - if (**it != 's') { // skip section headers - out(*it+1); - out("\n"); - if (**it == 'd') - out("\nOptions:\n"); - } - } - } -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CmdLineParserBase.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/CmdLineParserBase.h deleted file mode 100644 index 0052f3423ac..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CmdLineParserBase.h +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************* -** CmdLineParserBase.h ** -** ** -** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** published by the Free Software Foundation; either version 3 of ** -** the License, or (at your option) any later version. ** -** ** -** This program is distributed in the hope that it will be useful, but ** -** WITHOUT ANY WARRANTY; without even the implied warranty of ** -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** -** GNU General Public License for more details. ** -** ** -** You should have received a copy of the GNU General Public License ** -** along with this program; if not, see <http://www.gnu.org/licenses/>. ** -*************************************************************************/ - -#ifndef DVISVGM_CMDLINEPARSERBASE_H -#define DVISVGM_CMDLINEPARSERBASE_H - -#include <string> -#include <vector> - -class InputReader; - -class CmdLineParserBase -{ - protected: - struct Option; - - struct OptionHandler { - virtual ~OptionHandler () {} - virtual void operator () (CmdLineParserBase *obj, InputReader &ir, const Option &opt, bool longopt) const=0; - }; - - template <typename T> - class OptionHandlerImpl : public OptionHandler { - protected: - typedef void (T::*LocalHandler)(InputReader &ir, const Option &opt, bool longopt); - - public: - OptionHandlerImpl (LocalHandler handler) : _handler(handler) {} - - void operator () (CmdLineParserBase *obj, InputReader &ir, const Option &opt, bool longopt) const { - if (T *tobj = dynamic_cast<T*>(obj)) - (tobj->*_handler)(ir, opt, longopt); - } - - private: - LocalHandler _handler; - }; - - enum ArgMode {ARG_NONE, ARG_OPTIONAL, ARG_REQUIRED}; - - struct Option { - ~Option () {delete handler;} - char shortname; - const char *longname; - ArgMode argmode; // mode of option argument - const OptionHandler *handler; - }; - - public: - virtual void parse (int argc, char **argv, bool printErrors=true); - virtual void help (int mode=0, void (*out)(const char*)=0) const; - virtual int numFiles () const {return _files.size();} - virtual const char* file (size_t n) {return n < _files.size() ? _files[n].c_str() : 0;} -// virtual void status () const; - virtual bool error () const {return _error;} - - protected: - CmdLineParserBase () : _printErrors(true), _error(false) {} - CmdLineParserBase (const CmdLineParserBase &cmd) : _printErrors(true), _error(false) {} - virtual ~CmdLineParserBase () {} - virtual void init (); - virtual void error (const Option &opt, bool longopt, const char *msg) const; - virtual const Option* options (size_t *numopts) const =0; - virtual const char** helplines (size_t *numlines) const =0; - bool checkArgPrefix (InputReader &ir, const Option &opt, bool longopt) const; - bool checkNoArg (InputReader &ir, const Option &opt, bool longopt) const; - bool getIntArg (InputReader &ir, const Option &opt, bool longopt, int &arg) const; - bool getUIntArg (InputReader &ir, const Option &opt, bool longopt, unsigned &arg) const; - bool getDoubleArg (InputReader &ir, const Option &opt, bool longopt, double &arg) const; - bool getStringArg (InputReader &ir, const Option &opt, bool longopt, std::string &arg) const; - bool getBoolArg (InputReader &ir, const Option &opt, bool longopt, bool &arg) const; - bool getCharArg (InputReader &ir, const Option &opt, bool longopt, char &arg) const; - const Option* option (char shortname) const; - const Option* option (const std::string &longname) const; - - private: - bool _printErrors; ///< if true, print error messages - mutable bool _error; ///< error occured while parsing options - std::vector<std::string> _files; ///< filename parameters -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp index e72968cbdd2..24989755be4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp @@ -2,7 +2,7 @@ ** Color.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -20,6 +20,7 @@ #define _USE_MATH_DEFINES #include <config.h> +#include <array> #include <algorithm> #include <cctype> #include <cmath> @@ -27,38 +28,33 @@ #include <cstring> #include <iomanip> #include <sstream> -#include "Color.h" +#include "Color.hpp" +#include "utility.hpp" using namespace std; bool Color::SUPPRESS_COLOR_NAMES = true; -const Color Color::BLACK(UInt32(0)); -const Color Color::WHITE(UInt8(255), UInt8(255), UInt8(255)); -const Color Color::TRANSPARENT(UInt32(0xff000000)); +const Color Color::BLACK(uint32_t(0)); +const Color Color::WHITE(uint8_t(255), uint8_t(255), uint8_t(255)); +const Color Color::TRANSPARENT(uint32_t(0xff000000)); -static inline UInt8 double_to_byte (double v) { +static inline uint8_t double_to_byte (double v) { v = max(0.0, min(1.0, v)); - return UInt8(floor(255*v+0.5)); -} - - -static void tolower (string &str) { - for (size_t i=0; i < str.length(); i++) - str[i] = tolower(str[i]); + return uint8_t(floor(255*v+0.5)); } Color::Color (const char *psname) { if (!setPSName(psname, false)) - setGray(UInt8(0)); + setGray(uint8_t(0)); } Color::Color (const string &psname) { if (!setPSName(psname, false)) - setGray(UInt8(0)); + setGray(uint8_t(0)); } @@ -74,17 +70,18 @@ void Color::setRGB (double r, double g, double b) { bool Color::setPSName (string name, bool case_sensitive) { if (name[0] == '#') { char *p=0; - _rgb = UInt32(strtol(name.c_str()+1, &p, 16)); + _rgb = uint32_t(strtol(name.c_str()+1, &p, 16)); while (isspace(*p)) p++; return (*p == 0 && _rgb <= 0xFFFFFF); } - // converted color constants from color.pro - static const struct ColorConstant { + + struct ColorConstant { const char *name; - const UInt32 rgb; - } - constants[] = { + const uint32_t rgb; + }; + // converted color constants from color.pro + static const array<ColorConstant, 68> constants = {{ {"Apricot", 0xFFAD7A}, {"Aquamarine", 0x2DFFB2}, {"Bittersweet", 0xC10200}, @@ -153,31 +150,28 @@ bool Color::setPSName (string name, bool case_sensitive) { {"Yellow", 0xFFFF00}, {"YellowGreen", 0x8EFF42}, {"YellowOrange", 0xFF9300}, - }; - if (!case_sensitive) { - tolower(name); - for (size_t i=0; i < sizeof(constants)/sizeof(ColorConstant); i++) { - string cmpname = constants[i].name; - tolower(cmpname); - if (name == cmpname) { - _rgb = constants[i].rgb; - return true; + }}; + if (case_sensitive) { + const ColorConstant cmppair = {name.c_str(), 0}; + auto it = lower_bound(constants.begin(), constants.end(), cmppair, + [](const ColorConstant &c1, const ColorConstant &c2) { + return strcmp(c1.name, c2.name) < 0; } + ); + if (it != constants.end() && it->name == name) { + _rgb = it->rgb; + return true; } - return false; } - - // binary search - int first=0, last=sizeof(constants)/sizeof(ColorConstant)-1; - while (first <= last) { - int mid = first+(last-first)/2; - int cmp = strcmp(constants[mid].name, name.c_str()); - if (cmp > 0) - last = mid-1; - else if (cmp < 0) - first = mid+1; - else { - _rgb = constants[mid].rgb; + else { + util::tolower(name); + auto it = find_if(constants.begin(), constants.end(), [&](const ColorConstant &cc) { + string cmpname = cc.name; + util::tolower(cmpname); + return name == cmpname; + }); + if (it != constants.end()) { + _rgb = it->rgb; return true; } } @@ -215,18 +209,18 @@ void Color::setCMYK (const std::valarray<double> &cmyk) { void Color::set (ColorSpace colorSpace, VectorIterator<double> &it) { switch (colorSpace) { - case GRAY_SPACE: setGray(*it++); break; - case RGB_SPACE : setRGB(*it, *(it+1), *(it+2)); it+=3; break; - case LAB_SPACE : setLab(*it, *(it+1), *(it+2)); it+=3; break; - case CMYK_SPACE: setCMYK(*it, *(it+1), *(it+2), *(it+3)); it+=4; break; + case ColorSpace::GRAY: setGray(*it++); break; + case ColorSpace::RGB : setRGB(*it, *(it+1), *(it+2)); it+=3; break; + case ColorSpace::LAB : setLab(*it, *(it+1), *(it+2)); it+=3; break; + case ColorSpace::CMYK: setCMYK(*it, *(it+1), *(it+2), *(it+3)); it+=4; break; } } void Color::operator *= (double c) { - UInt32 rgb=0; + uint32_t rgb=0; for (int i=0; i < 3; i++) { - rgb |= UInt32(floor((_rgb & 0xff)*c+0.5)) << (8*i); + rgb |= uint32_t(floor((_rgb & 0xff)*c+0.5)) << (8*i); _rgb >>= 8; } _rgb = rgb; @@ -250,10 +244,11 @@ string Color::rgbString () const { * define a name for the current color. */ string Color::svgColorString (bool rgbonly) const { if (!rgbonly) { - static const struct ColorName { - UInt32 rgb; + struct ColorName { + uint32_t rgb; const char *name; - } colornames[] = { + }; + static const array<ColorName, 138> colornames = {{ {0x000000, "black"}, {0x000080, "navy"}, {0x00008b, "darkblue"}, @@ -392,18 +387,13 @@ string Color::svgColorString (bool rgbonly) const { {0xffffe0, "lightyellow"}, {0xfffff0, "ivory"}, {0xffffff, "white"} - }; - int left=0; - int right=sizeof(colornames)/sizeof(ColorName)-1; - while (left <= right) { - int mid = left+(right-left)/2; - if (colornames[mid].rgb == _rgb) - return colornames[mid].name; - if (colornames[mid].rgb > _rgb) - right = mid-1; - else - left = mid+1; - } + }}; + ColorName cmppair = {_rgb, 0}; + auto it = lower_bound(colornames.begin(), colornames.end(), cmppair, [](const ColorName &c1, const ColorName &c2) { + return c1.rgb < c2.rgb; + }); + if (it != colornames.end() && it->rgb == _rgb) + return it->name; } return rgbString(); } @@ -670,10 +660,10 @@ double Color::deltaE (const Color &c) const { int Color::numComponents (ColorSpace colorSpace) { switch (colorSpace) { - case GRAY_SPACE: return 1; - case LAB_SPACE: - case RGB_SPACE: return 3; - case CMYK_SPACE: return 4; + case ColorSpace::GRAY: return 1; + case ColorSpace::LAB: + case ColorSpace::RGB: return 3; + case ColorSpace::CMYK: return 4; } return 0; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.hpp index 40aa1f12be7..e587cc6a8dc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** Color.h ** +** Color.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,14 +18,13 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_COLOR_H -#define DVISVGM_COLOR_H +#ifndef COLOR_HPP +#define COLOR_HPP #include <string> #include <valarray> #include <vector> -#include "types.h" -#include "VectorIterator.h" +#include "VectorIterator.hpp" #ifdef TRANSPARENT #undef TRANSPARENT @@ -39,25 +38,24 @@ class Color static const Color WHITE; static const Color TRANSPARENT; - enum ColorSpace {GRAY_SPACE, RGB_SPACE, CMYK_SPACE, LAB_SPACE}; + enum class ColorSpace {GRAY, RGB, CMYK, LAB}; public: Color () : _rgb(0) {} - Color (UInt32 rgb) : _rgb(rgb) {} - Color (UInt8 r, UInt8 g, UInt8 b) {setRGB(r,g,b);} + Color (uint32_t rgb) : _rgb(rgb) {} + Color (uint8_t r, uint8_t g, uint8_t b) {setRGB(r,g,b);} Color (double r, double g, double b) {setRGB(r,g,b);} Color (const std::valarray<double> &rgb) {setRGB(rgb);} Color (const char *name); Color (const std::string &name); -// Color (ColorSpace colorSpace, std::vector<double>::const_iterator &it) {set(colorSpace, it);} - operator UInt32 () const {return _rgb;} - bool operator == (const Color &c) const {return _rgb == c._rgb;} - bool operator != (const Color &c) const {return _rgb != c._rgb;} - void setRGB (UInt8 r, UInt8 g, UInt8 b) {_rgb = (r << 16) | (g << 8) | b;} + operator uint32_t () const {return _rgb;} + bool operator == (const Color &c) const {return _rgb == c._rgb;} + bool operator != (const Color &c) const {return _rgb != c._rgb;} + void setRGB (uint8_t r, uint8_t g, uint8_t b) {_rgb = (r << 16) | (g << 8) | b;} void setRGB (double r, double g, double b); void setRGB (const std::valarray<double> &rgb) {setRGB(rgb[0], rgb[1], rgb[2]);} bool setPSName (std::string name, bool case_sensitive=true); - void setGray (UInt8 g) {setRGB(g,g,g);} + void setGray (uint8_t g) {setRGB(g,g,g);} void setGray (double g) {setRGB(g,g,g);} void setGray (const std::valarray<double> &gray) {setRGB(gray[0], gray[0], gray[0]);} void setHSB (double h, double s, double b); @@ -92,7 +90,7 @@ class Color static int numComponents (ColorSpace colorSpace); private: - UInt32 _rgb; + uint32_t _rgb; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp index 07426645cbe..1bc7067c23a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp @@ -2,7 +2,7 @@ ** ColorSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -22,8 +22,8 @@ #include <cstring> #include <sstream> #include <vector> -#include "ColorSpecialHandler.h" -#include "SpecialActions.h" +#include "ColorSpecialHandler.hpp" +#include "SpecialActions.hpp" using namespace std; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.hpp index bec15f6c53a..079618f73ca 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** ColorSpecialHandler.h ** +** ColorSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,25 +18,25 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_COLORSPECIALHANDLER_H -#define DVISVGM_COLORSPECIALHANDLER_H +#ifndef COLORSPECIALHANDLER_HPP +#define COLORSPECIALHANDLER_HPP #include <stack> #include <string> #include <vector> -#include "Color.h" -#include "SpecialHandler.h" +#include "Color.hpp" +#include "SpecialHandler.hpp" class ColorSpecialHandler : public SpecialHandler { public: - bool process (const char *prefix, std::istream &is, SpecialActions &actions); + bool process (const char *prefix, std::istream &is, SpecialActions &actions) override; static Color readColor (std::istream &is); static Color readColor (const std::string &model, std::istream &is); - const char* name () const {return "color";} - const char* info () const {return "complete support of color specials";} - const char** prefixes () const; + const char* name () const override {return "color";} + const char* info () const override {return "complete support of color specials";} + const char** prefixes () const override; private: std::stack<Color> _colorStack; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.cpp deleted file mode 100644 index 5618d1fa3cf..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.cpp +++ /dev/null @@ -1,410 +0,0 @@ -// This file was automatically generated by opt2cpp. -// It is part of the dvisvgm package and published under the terms -// of the GNU General Public License version 3, or (at your option) any later version. -// See file COPYING for further details. -// (C) 2009-2016 Martin Gieseking <martin.gieseking@uos.de> - -#include <config.h> -#include <cstdio> -#include "InputReader.h" -#include "CommandLine.h" - -using namespace std; - -const CmdLineParserBase::Option CommandLine::_options[] = { - {'b', "bbox", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_bbox)}, - {'C', "cache", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_cache)}, -#if !defined(DISABLE_GS) - {'j', "clipjoin", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_clipjoin)}, -#endif - {'\0', "color", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_color)}, - {'\0', "colornames", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_colornames)}, - {'\0', "comments", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_comments)}, -#if !defined(DISABLE_GS) - {'E', "eps", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_eps)}, -#endif - {'e', "exact", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_exact)}, - {'m', "fontmap", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_fontmap)}, -#if !defined(DISABLE_GS) - {'\0', "grad-overlap", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_grad_overlap)}, -#endif -#if !defined(DISABLE_GS) - {'\0', "grad-segments", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_grad_segments)}, -#endif -#if !defined(DISABLE_GS) - {'\0', "grad-simplify", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_grad_simplify)}, -#endif - {'h', "help", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_help)}, - {'\0', "keep", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_keep)}, -#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) - {'\0', "libgs", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_libgs)}, -#endif - {'L', "linkmark", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_linkmark)}, - {'l', "list-specials", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_list_specials)}, - {'M', "mag", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_mag)}, - {'n', "no-fonts", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_no_fonts)}, - {'\0', "no-merge", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_no_merge)}, - {'\0', "no-mktexmf", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_no_mktexmf)}, - {'S', "no-specials", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_no_specials)}, - {'\0', "no-styles", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_no_styles)}, - {'o', "output", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_output)}, - {'p', "page", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_page)}, - {'d', "precision", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_precision)}, - {'P', "progress", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_progress)}, - {'R', "relative", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_relative)}, - {'r', "rotate", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_rotate)}, - {'c', "scale", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_scale)}, - {'s', "stdout", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_stdout)}, - {'a', "trace-all", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_trace_all)}, - {'T', "transform", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_transform)}, - {'t', "translate", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_translate)}, - {'v', "verbosity", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_verbosity)}, - {'V', "version", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_version)}, - {'z', "zip", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_zip)}, - {'Z', "zoom", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_zoom)}, -}; - -const CmdLineParserBase::Option* CommandLine::options (size_t *numopts) const { - *numopts = sizeof(_options)/sizeof(CmdLineParserBase::Option); - return _options; -} - -void CommandLine::init () { - CmdLineParserBase::init(); - - // disable all options by default - _bbox_given = false; - _cache_given = false; -#if !defined(DISABLE_GS) - _clipjoin_given = false; -#endif - _color_given = false; - _colornames_given = false; - _comments_given = false; -#if !defined(DISABLE_GS) - _eps_given = false; -#endif - _exact_given = false; - _fontmap_given = false; -#if !defined(DISABLE_GS) - _grad_overlap_given = false; -#endif -#if !defined(DISABLE_GS) - _grad_segments_given = false; -#endif -#if !defined(DISABLE_GS) - _grad_simplify_given = false; -#endif - _help_given = false; - _keep_given = false; -#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) - _libgs_given = false; -#endif - _linkmark_given = false; - _list_specials_given = false; - _mag_given = false; - _no_fonts_given = false; - _no_merge_given = false; - _no_mktexmf_given = false; - _no_specials_given = false; - _no_styles_given = false; - _output_given = false; - _page_given = false; - _precision_given = false; - _progress_given = false; - _relative_given = false; - _rotate_given = false; - _scale_given = false; - _stdout_given = false; - _trace_all_given = false; - _transform_given = false; - _translate_given = false; - _verbosity_given = false; - _version_given = false; - _zip_given = false; - _zoom_given = false; - - // set default option values - _bbox_arg = "min"; - _cache_arg.clear(); - _fontmap_arg.clear(); -#if !defined(DISABLE_GS) - _grad_segments_arg = 20; -#endif -#if !defined(DISABLE_GS) - _grad_simplify_arg = 0.05; -#endif - _help_arg = 0; -#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) - _libgs_arg.clear(); -#endif - _linkmark_arg = "box"; - _mag_arg = 4; - _no_fonts_arg = 0; - _no_specials_arg.clear(); - _output_arg.clear(); - _page_arg = "1"; - _precision_arg = 0; - _progress_arg = 0.5; - _rotate_arg = 0; - _scale_arg.clear(); - _trace_all_arg = false; - _transform_arg.clear(); - _translate_arg.clear(); - _verbosity_arg = 7; - _version_arg = false; - _zip_arg = 9; - _zoom_arg = 1.0; -} - -const char** CommandLine::helplines (size_t *numlines) const { - static const char *lines[] = { - "dThis program converts DVI files, as created by TeX/LaTeX, to\nthe XML-based scalable vector graphics format SVG.\n\nUsage: dvisvgm [options] dvifile\n dvisvgm -E [options] epsfile", - "sInput options:", - "o-p, --page=ranges choose pages to convert [1]", - "o-m, --fontmap=filenames evaluate (additional) font map files", -#if !defined(DISABLE_GS) - "o-E, --eps convert an EPS file to SVG", -#endif - "sSVG output options:", - "o-b, --bbox=size set size of bounding box [min]", -#if !defined(DISABLE_GS) - "o-j, --clipjoin compute intersection of clipping paths", -#endif - "o --colornames prefer color names to RGB values if possible", - "o --comments add comments with additional information", -#if !defined(DISABLE_GS) - "o --grad-overlap create operlapping color gradient segments", -#endif -#if !defined(DISABLE_GS) - "o --grad-segments=number number of color gradient segments per row [20]", -#endif -#if !defined(DISABLE_GS) - "o --grad-simplify=delta reduce level of detail for small segments [0.05]", -#endif - "o-L, --linkmark=style select how to mark hyperlinked areas [box]", - "o-o, --output=pattern set name pattern of output files", - "o-d, --precision=number set number of decimal points (0-6) [0]", - "o-R, --relative create relative path commands", - "o-s, --stdout write SVG output to stdout", - "o-n, --no-fonts[=variant] draw glyphs by using path elements [0]", - "o --no-merge don't merge adjacent text elements", - "o --no-styles don't use styles to reference fonts", - "o-z, --zip[=level] create compressed .svgz file [9]", - "sSVG transformations:", - "o-r, --rotate=angle rotate page content clockwise", - "o-c, --scale=sx[,sy] scale page content", - "o-t, --translate=tx[,ty] shift page content", - "o-T, --transform=commands transform page content", - "o-Z, --zoom=factor zoom page content [1.0]", - "sProcessing options:", - "o-C, --cache[=dir] set/print path of cache directory", - "o-e, --exact compute exact glyph boxes", - "o --keep keep temporary files", -#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) - "o --libgs=filename set name of Ghostscript shared library", -#endif - "o-M, --mag=factor magnification of Metafont output [4]", - "o --no-mktexmf don't try to create missing fonts", - "o-S, --no-specials[=prefixes] don't process [selected] specials", - "o-a, --trace-all[=retrace] trace all glyphs of bitmap fonts [no]", - "sMessage options:", - "o --color colorize messages", - "o-h, --help[=mode] print this summary of options and exit [0]", - "o-l, --list-specials print supported special sets and exit", - "o-P, --progress[=delay] enable progess indicator [0.5]", - "o-v, --verbosity=level set verbosity level (0-7) [7]", - "o-V, --version[=extended] print version and exit [no]", - }; - *numlines = sizeof(lines)/sizeof(char*); - return lines; -} - -void CommandLine::handle_bbox (InputReader &ir, const Option &opt, bool longopt) { - if (getStringArg(ir, opt, longopt, _bbox_arg)) - _bbox_given = true; -} - -void CommandLine::handle_cache (InputReader &ir, const Option &opt, bool longopt) { - if (ir.eof() || getStringArg(ir, opt, longopt, _cache_arg)) - _cache_given = true; -} - -#if !defined(DISABLE_GS) -void CommandLine::handle_clipjoin (InputReader &ir, const Option &opt, bool longopt) { - _clipjoin_given = true; -} -#endif - -void CommandLine::handle_color (InputReader &ir, const Option &opt, bool longopt) { - _color_given = true; -} - -void CommandLine::handle_colornames (InputReader &ir, const Option &opt, bool longopt) { - _colornames_given = true; -} - -void CommandLine::handle_comments (InputReader &ir, const Option &opt, bool longopt) { - _comments_given = true; -} - -#if !defined(DISABLE_GS) -void CommandLine::handle_eps (InputReader &ir, const Option &opt, bool longopt) { - _eps_given = true; -} -#endif - -void CommandLine::handle_exact (InputReader &ir, const Option &opt, bool longopt) { - _exact_given = true; -} - -void CommandLine::handle_fontmap (InputReader &ir, const Option &opt, bool longopt) { - if (getStringArg(ir, opt, longopt, _fontmap_arg)) - _fontmap_given = true; -} - -#if !defined(DISABLE_GS) -void CommandLine::handle_grad_overlap (InputReader &ir, const Option &opt, bool longopt) { - _grad_overlap_given = true; -} -#endif - -#if !defined(DISABLE_GS) -void CommandLine::handle_grad_segments (InputReader &ir, const Option &opt, bool longopt) { - if (getIntArg(ir, opt, longopt, _grad_segments_arg)) - _grad_segments_given = true; -} -#endif - -#if !defined(DISABLE_GS) -void CommandLine::handle_grad_simplify (InputReader &ir, const Option &opt, bool longopt) { - if (getDoubleArg(ir, opt, longopt, _grad_simplify_arg)) - _grad_simplify_given = true; -} -#endif - -void CommandLine::handle_help (InputReader &ir, const Option &opt, bool longopt) { - if (ir.eof() || getIntArg(ir, opt, longopt, _help_arg)) - _help_given = true; -} - -void CommandLine::handle_keep (InputReader &ir, const Option &opt, bool longopt) { - _keep_given = true; -} - -#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) -void CommandLine::handle_libgs (InputReader &ir, const Option &opt, bool longopt) { - if (getStringArg(ir, opt, longopt, _libgs_arg)) - _libgs_given = true; -} -#endif - -void CommandLine::handle_linkmark (InputReader &ir, const Option &opt, bool longopt) { - if (getStringArg(ir, opt, longopt, _linkmark_arg)) - _linkmark_given = true; -} - -void CommandLine::handle_list_specials (InputReader &ir, const Option &opt, bool longopt) { - _list_specials_given = true; -} - -void CommandLine::handle_mag (InputReader &ir, const Option &opt, bool longopt) { - if (getDoubleArg(ir, opt, longopt, _mag_arg)) - _mag_given = true; -} - -void CommandLine::handle_no_fonts (InputReader &ir, const Option &opt, bool longopt) { - if (ir.eof() || getIntArg(ir, opt, longopt, _no_fonts_arg)) - _no_fonts_given = true; -} - -void CommandLine::handle_no_merge (InputReader &ir, const Option &opt, bool longopt) { - _no_merge_given = true; -} - -void CommandLine::handle_no_mktexmf (InputReader &ir, const Option &opt, bool longopt) { - _no_mktexmf_given = true; -} - -void CommandLine::handle_no_specials (InputReader &ir, const Option &opt, bool longopt) { - if (ir.eof() || getStringArg(ir, opt, longopt, _no_specials_arg)) - _no_specials_given = true; -} - -void CommandLine::handle_no_styles (InputReader &ir, const Option &opt, bool longopt) { - _no_styles_given = true; -} - -void CommandLine::handle_output (InputReader &ir, const Option &opt, bool longopt) { - if (getStringArg(ir, opt, longopt, _output_arg)) - _output_given = true; -} - -void CommandLine::handle_page (InputReader &ir, const Option &opt, bool longopt) { - if (getStringArg(ir, opt, longopt, _page_arg)) - _page_given = true; -} - -void CommandLine::handle_precision (InputReader &ir, const Option &opt, bool longopt) { - if (getIntArg(ir, opt, longopt, _precision_arg)) - _precision_given = true; -} - -void CommandLine::handle_progress (InputReader &ir, const Option &opt, bool longopt) { - if (ir.eof() || getDoubleArg(ir, opt, longopt, _progress_arg)) - _progress_given = true; -} - -void CommandLine::handle_relative (InputReader &ir, const Option &opt, bool longopt) { - _relative_given = true; -} - -void CommandLine::handle_rotate (InputReader &ir, const Option &opt, bool longopt) { - if (getDoubleArg(ir, opt, longopt, _rotate_arg)) - _rotate_given = true; -} - -void CommandLine::handle_scale (InputReader &ir, const Option &opt, bool longopt) { - if (getStringArg(ir, opt, longopt, _scale_arg)) - _scale_given = true; -} - -void CommandLine::handle_stdout (InputReader &ir, const Option &opt, bool longopt) { - _stdout_given = true; -} - -void CommandLine::handle_trace_all (InputReader &ir, const Option &opt, bool longopt) { - if (ir.eof() || getBoolArg(ir, opt, longopt, _trace_all_arg)) - _trace_all_given = true; -} - -void CommandLine::handle_transform (InputReader &ir, const Option &opt, bool longopt) { - if (getStringArg(ir, opt, longopt, _transform_arg)) - _transform_given = true; -} - -void CommandLine::handle_translate (InputReader &ir, const Option &opt, bool longopt) { - if (getStringArg(ir, opt, longopt, _translate_arg)) - _translate_given = true; -} - -void CommandLine::handle_verbosity (InputReader &ir, const Option &opt, bool longopt) { - if (getUIntArg(ir, opt, longopt, _verbosity_arg)) - _verbosity_given = true; -} - -void CommandLine::handle_version (InputReader &ir, const Option &opt, bool longopt) { - if (ir.eof() || getBoolArg(ir, opt, longopt, _version_arg)) - _version_given = true; -} - -void CommandLine::handle_zip (InputReader &ir, const Option &opt, bool longopt) { - if (ir.eof() || getIntArg(ir, opt, longopt, _zip_arg)) - _zip_given = true; -} - -void CommandLine::handle_zoom (InputReader &ir, const Option &opt, bool longopt) { - if (getDoubleArg(ir, opt, longopt, _zoom_arg)) - _zoom_given = true; -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.h deleted file mode 100644 index 68ea640a942..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.h +++ /dev/null @@ -1,225 +0,0 @@ -// This file was automatically generated by opt2cpp. -// It is part of the dvisvgm package and published under the terms -// of the GNU General Public License version 3, or (at your option) any later version. -// See file COPYING for further details. -// (C) 2009-2016 Martin Gieseking <martin.gieseking@uos.de> - -#ifndef COMMANDLINE_H -#define COMMANDLINE_H - -#include <config.h> -#include "CmdLineParserBase.h" - -class CommandLine : public CmdLineParserBase -{ - public: - CommandLine () {init();} - CommandLine (int argc, char **argv, bool printErrors) {parse(argc, argv, printErrors);} - bool bbox_given () const {return _bbox_given;} - const std::string& bbox_arg () const {return _bbox_arg;} - bool cache_given () const {return _cache_given;} - const std::string& cache_arg () const {return _cache_arg;} -#if !defined(DISABLE_GS) - bool clipjoin_given () const {return _clipjoin_given;} -#endif - bool color_given () const {return _color_given;} - bool colornames_given () const {return _colornames_given;} - bool comments_given () const {return _comments_given;} -#if !defined(DISABLE_GS) - bool eps_given () const {return _eps_given;} -#endif - bool exact_given () const {return _exact_given;} - bool fontmap_given () const {return _fontmap_given;} - const std::string& fontmap_arg () const {return _fontmap_arg;} -#if !defined(DISABLE_GS) - bool grad_overlap_given () const {return _grad_overlap_given;} -#endif -#if !defined(DISABLE_GS) - bool grad_segments_given () const {return _grad_segments_given;} - int grad_segments_arg () const {return _grad_segments_arg;} -#endif -#if !defined(DISABLE_GS) - bool grad_simplify_given () const {return _grad_simplify_given;} - double grad_simplify_arg () const {return _grad_simplify_arg;} -#endif - bool help_given () const {return _help_given;} - int help_arg () const {return _help_arg;} - bool keep_given () const {return _keep_given;} -#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) - bool libgs_given () const {return _libgs_given;} - const std::string& libgs_arg () const {return _libgs_arg;} -#endif - bool linkmark_given () const {return _linkmark_given;} - const std::string& linkmark_arg () const {return _linkmark_arg;} - bool list_specials_given () const {return _list_specials_given;} - bool mag_given () const {return _mag_given;} - double mag_arg () const {return _mag_arg;} - bool no_fonts_given () const {return _no_fonts_given;} - int no_fonts_arg () const {return _no_fonts_arg;} - bool no_merge_given () const {return _no_merge_given;} - bool no_mktexmf_given () const {return _no_mktexmf_given;} - bool no_specials_given () const {return _no_specials_given;} - const std::string& no_specials_arg () const {return _no_specials_arg;} - bool no_styles_given () const {return _no_styles_given;} - bool output_given () const {return _output_given;} - const std::string& output_arg () const {return _output_arg;} - bool page_given () const {return _page_given;} - const std::string& page_arg () const {return _page_arg;} - bool precision_given () const {return _precision_given;} - int precision_arg () const {return _precision_arg;} - bool progress_given () const {return _progress_given;} - double progress_arg () const {return _progress_arg;} - bool relative_given () const {return _relative_given;} - bool rotate_given () const {return _rotate_given;} - double rotate_arg () const {return _rotate_arg;} - bool scale_given () const {return _scale_given;} - const std::string& scale_arg () const {return _scale_arg;} - bool stdout_given () const {return _stdout_given;} - bool trace_all_given () const {return _trace_all_given;} - bool trace_all_arg () const {return _trace_all_arg;} - bool transform_given () const {return _transform_given;} - const std::string& transform_arg () const {return _transform_arg;} - bool translate_given () const {return _translate_given;} - const std::string& translate_arg () const {return _translate_arg;} - bool verbosity_given () const {return _verbosity_given;} - unsigned verbosity_arg () const {return _verbosity_arg;} - bool version_given () const {return _version_given;} - bool version_arg () const {return _version_arg;} - bool zip_given () const {return _zip_given;} - int zip_arg () const {return _zip_arg;} - bool zoom_given () const {return _zoom_given;} - double zoom_arg () const {return _zoom_arg;} - protected: - void init (); - const CmdLineParserBase::Option* options (size_t *numopts) const; - const char** helplines (size_t *numlines) const; - void handle_bbox (InputReader &ir, const Option &opt, bool longopt); - void handle_cache (InputReader &ir, const Option &opt, bool longopt); -#if !defined(DISABLE_GS) - void handle_clipjoin (InputReader &ir, const Option &opt, bool longopt); -#endif - void handle_color (InputReader &ir, const Option &opt, bool longopt); - void handle_colornames (InputReader &ir, const Option &opt, bool longopt); - void handle_comments (InputReader &ir, const Option &opt, bool longopt); -#if !defined(DISABLE_GS) - void handle_eps (InputReader &ir, const Option &opt, bool longopt); -#endif - void handle_exact (InputReader &ir, const Option &opt, bool longopt); - void handle_fontmap (InputReader &ir, const Option &opt, bool longopt); -#if !defined(DISABLE_GS) - void handle_grad_overlap (InputReader &ir, const Option &opt, bool longopt); -#endif -#if !defined(DISABLE_GS) - void handle_grad_segments (InputReader &ir, const Option &opt, bool longopt); -#endif -#if !defined(DISABLE_GS) - void handle_grad_simplify (InputReader &ir, const Option &opt, bool longopt); -#endif - void handle_help (InputReader &ir, const Option &opt, bool longopt); - void handle_keep (InputReader &ir, const Option &opt, bool longopt); -#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) - void handle_libgs (InputReader &ir, const Option &opt, bool longopt); -#endif - void handle_linkmark (InputReader &ir, const Option &opt, bool longopt); - void handle_list_specials (InputReader &ir, const Option &opt, bool longopt); - void handle_mag (InputReader &ir, const Option &opt, bool longopt); - void handle_no_fonts (InputReader &ir, const Option &opt, bool longopt); - void handle_no_merge (InputReader &ir, const Option &opt, bool longopt); - void handle_no_mktexmf (InputReader &ir, const Option &opt, bool longopt); - void handle_no_specials (InputReader &ir, const Option &opt, bool longopt); - void handle_no_styles (InputReader &ir, const Option &opt, bool longopt); - void handle_output (InputReader &ir, const Option &opt, bool longopt); - void handle_page (InputReader &ir, const Option &opt, bool longopt); - void handle_precision (InputReader &ir, const Option &opt, bool longopt); - void handle_progress (InputReader &ir, const Option &opt, bool longopt); - void handle_relative (InputReader &ir, const Option &opt, bool longopt); - void handle_rotate (InputReader &ir, const Option &opt, bool longopt); - void handle_scale (InputReader &ir, const Option &opt, bool longopt); - void handle_stdout (InputReader &ir, const Option &opt, bool longopt); - void handle_trace_all (InputReader &ir, const Option &opt, bool longopt); - void handle_transform (InputReader &ir, const Option &opt, bool longopt); - void handle_translate (InputReader &ir, const Option &opt, bool longopt); - void handle_verbosity (InputReader &ir, const Option &opt, bool longopt); - void handle_version (InputReader &ir, const Option &opt, bool longopt); - void handle_zip (InputReader &ir, const Option &opt, bool longopt); - void handle_zoom (InputReader &ir, const Option &opt, bool longopt); - - private: - static const CmdLineParserBase::Option _options[]; - bool _bbox_given; - std::string _bbox_arg; - bool _cache_given; - std::string _cache_arg; -#if !defined(DISABLE_GS) - bool _clipjoin_given; -#endif - bool _color_given; - bool _colornames_given; - bool _comments_given; -#if !defined(DISABLE_GS) - bool _eps_given; -#endif - bool _exact_given; - bool _fontmap_given; - std::string _fontmap_arg; -#if !defined(DISABLE_GS) - bool _grad_overlap_given; -#endif -#if !defined(DISABLE_GS) - bool _grad_segments_given; - int _grad_segments_arg; -#endif -#if !defined(DISABLE_GS) - bool _grad_simplify_given; - double _grad_simplify_arg; -#endif - bool _help_given; - int _help_arg; - bool _keep_given; -#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) - bool _libgs_given; - std::string _libgs_arg; -#endif - bool _linkmark_given; - std::string _linkmark_arg; - bool _list_specials_given; - bool _mag_given; - double _mag_arg; - bool _no_fonts_given; - int _no_fonts_arg; - bool _no_merge_given; - bool _no_mktexmf_given; - bool _no_specials_given; - std::string _no_specials_arg; - bool _no_styles_given; - bool _output_given; - std::string _output_arg; - bool _page_given; - std::string _page_arg; - bool _precision_given; - int _precision_arg; - bool _progress_given; - double _progress_arg; - bool _relative_given; - bool _rotate_given; - double _rotate_arg; - bool _scale_given; - std::string _scale_arg; - bool _stdout_given; - bool _trace_all_given; - bool _trace_all_arg; - bool _transform_given; - std::string _transform_arg; - bool _translate_given; - std::string _translate_arg; - bool _verbosity_given; - unsigned _verbosity_arg; - bool _version_given; - bool _version_arg; - bool _zip_given; - int _zip_arg; - bool _zoom_given; - double _zoom_arg; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.hpp new file mode 100644 index 00000000000..f412aa2927d --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.hpp @@ -0,0 +1,145 @@ +// This file was automatically generated by opt2cpp. +// It is part of the dvisvgm package and published under the terms +// of the GNU General Public License version 3, or (at your option) any later version. +// See file COPYING for further details. +// Copyright (C) 2016-2017 Martin Gieseking <martin.gieseking@uos.de> + +#ifndef COMMANDLINE_HPP +#define COMMANDLINE_HPP + +#include <config.h> +#include <array> +#include <vector> +#include "CLCommandLine.hpp" + +using CL::Option; +using CL::TypedOption; + +class CommandLine : public CL::CommandLine +{ + public: + CommandLine () : CL::CommandLine( + "This program converts DVI files, as created by TeX/LaTeX, to\nthe XML-based scalable vector graphics format SVG.", + "[options] dvifile\n-E [options] epsfile", + "Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de>" + ) {} + + CommandLine (int argc, char **argv) : CommandLine() { + parse(argc, argv); + } + + // option variables + TypedOption<std::string, Option::ArgMode::REQUIRED> bboxOpt {"bbox", 'b', "size", "min", "set size of bounding box"}; + TypedOption<std::string, Option::ArgMode::OPTIONAL> cacheOpt {"cache", 'C', "dir", "set/print path of cache directory"}; + Option clipjoinOpt {"clipjoin", 'j', "compute intersection of clipping paths"}; + Option colorOpt {"color", '\0', "colorize messages"}; + Option colornamesOpt {"colornames", '\0', "prefer color names to RGB values if possible"}; + Option commentsOpt {"comments", '\0', "add comments with additional information"}; + Option epsOpt {"eps", 'E', "convert an EPS file to SVG"}; + Option exactOpt {"exact", 'e', "compute exact glyph boxes"}; + TypedOption<std::string, Option::ArgMode::REQUIRED> fontFormatOpt {"font-format", 'f', "format", "svg", "select file format of embedded fonts"}; + TypedOption<std::string, Option::ArgMode::REQUIRED> fontmapOpt {"fontmap", 'm', "filenames", "evaluate (additional) font map files"}; + Option gradOverlapOpt {"grad-overlap", '\0', "create overlapping color gradient segments"}; + TypedOption<int, Option::ArgMode::REQUIRED> gradSegmentsOpt {"grad-segments", '\0', "number", 20, "number of color gradient segments per row"}; + TypedOption<double, Option::ArgMode::REQUIRED> gradSimplifyOpt {"grad-simplify", '\0', "delta", 0.05, "reduce level of detail for small segments"}; + TypedOption<int, Option::ArgMode::OPTIONAL> helpOpt {"help", 'h', "mode", 0, "print this summary of options and exit"}; + Option keepOpt {"keep", '\0', "keep temporary files"}; + TypedOption<std::string, Option::ArgMode::REQUIRED> libgsOpt {"libgs", '\0', "filename", "set name of Ghostscript shared library"}; + TypedOption<std::string, Option::ArgMode::REQUIRED> linkmarkOpt {"linkmark", 'L', "style", "box", "select how to mark hyperlinked areas"}; + Option listSpecialsOpt {"list-specials", 'l', "print supported special sets and exit"}; + TypedOption<double, Option::ArgMode::REQUIRED> magOpt {"mag", 'M', "factor", 4, "magnification of Metafont output"}; + TypedOption<int, Option::ArgMode::OPTIONAL> noFontsOpt {"no-fonts", 'n', "variant", 0, "draw glyphs by using path elements"}; + Option noMergeOpt {"no-merge", '\0', "don't merge adjacent text elements"}; + Option noMktexmfOpt {"no-mktexmf", '\0', "don't try to create missing fonts"}; + TypedOption<std::string, Option::ArgMode::OPTIONAL> noSpecialsOpt {"no-specials", 'S', "prefixes", "don't process [selected] specials"}; + Option noStylesOpt {"no-styles", '\0', "don't use CSS styles to reference fonts"}; + TypedOption<std::string, Option::ArgMode::REQUIRED> outputOpt {"output", 'o', "pattern", "set name pattern of output files"}; + TypedOption<std::string, Option::ArgMode::REQUIRED> pageOpt {"page", 'p', "ranges", "1", "choose page(s) to convert"}; + TypedOption<int, Option::ArgMode::REQUIRED> precisionOpt {"precision", 'd', "number", 0, "set number of decimal points (0-6)"}; + TypedOption<double, Option::ArgMode::OPTIONAL> progressOpt {"progress", 'P', "delay", 0.5, "enable progress indicator"}; + Option relativeOpt {"relative", 'R', "create relative path commands"}; + TypedOption<double, Option::ArgMode::REQUIRED> rotateOpt {"rotate", 'r', "angle", "rotate page content clockwise"}; + TypedOption<std::string, Option::ArgMode::REQUIRED> scaleOpt {"scale", 'c', "sx[,sy]", "scale page content"}; + Option stdoutOpt {"stdout", 's', "write SVG output to stdout"}; + TypedOption<std::string, Option::ArgMode::OPTIONAL> tmpdirOpt {"tmpdir", '\0', "path", "set/print the directory for temporary files"}; + TypedOption<bool, Option::ArgMode::OPTIONAL> traceAllOpt {"trace-all", 'a', "retrace", false, "trace all glyphs of bitmap fonts"}; + TypedOption<std::string, Option::ArgMode::REQUIRED> transformOpt {"transform", 'T', "commands", "transform page content"}; + TypedOption<std::string, Option::ArgMode::REQUIRED> translateOpt {"translate", 't', "tx[,ty]", "shift page content"}; + TypedOption<unsigned, Option::ArgMode::REQUIRED> verbosityOpt {"verbosity", 'v', "level", 7, "set verbosity level (0-7)"}; + TypedOption<bool, Option::ArgMode::OPTIONAL> versionOpt {"version", 'V', "extended", false, "print version and exit"}; + TypedOption<int, Option::ArgMode::OPTIONAL> zipOpt {"zip", 'z', "level", 9, "create compressed .svgz file"}; + TypedOption<double, Option::ArgMode::REQUIRED> zoomOpt {"zoom", 'Z', "factor", 1.0, "zoom page content"}; + + protected: + std::vector<OptSectPair>& options () const override {return _options;} + const char* section (size_t n) const override {return n < _sections.size() ? _sections[n] : nullptr;} + + private: + std::array<const char*, 5> _sections = {{ + "Input options", + "SVG output options", + "SVG transformations", + "Processing options", + "Message options", + }}; + + mutable std::vector<OptSectPair> _options = { + {&pageOpt, 0}, + {&fontmapOpt, 0}, +#if !defined(DISABLE_GS) + {&epsOpt, 0}, +#endif + {&bboxOpt, 1}, +#if !defined(DISABLE_GS) + {&clipjoinOpt, 1}, +#endif + {&colornamesOpt, 1}, + {&commentsOpt, 1}, +#if !defined(DISABLE_WOFF) + {&fontFormatOpt, 1}, +#endif +#if !defined(DISABLE_GS) + {&gradOverlapOpt, 1}, +#endif +#if !defined(DISABLE_GS) + {&gradSegmentsOpt, 1}, +#endif +#if !defined(DISABLE_GS) + {&gradSimplifyOpt, 1}, +#endif + {&linkmarkOpt, 1}, + {&outputOpt, 1}, + {&precisionOpt, 1}, + {&relativeOpt, 1}, + {&stdoutOpt, 1}, + {&tmpdirOpt, 1}, + {&noFontsOpt, 1}, + {&noMergeOpt, 1}, + {&noStylesOpt, 1}, + {&zipOpt, 1}, + {&rotateOpt, 2}, + {&scaleOpt, 2}, + {&translateOpt, 2}, + {&transformOpt, 2}, + {&zoomOpt, 2}, + {&cacheOpt, 3}, + {&exactOpt, 3}, + {&keepOpt, 3}, +#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) + {&libgsOpt, 3}, +#endif + {&magOpt, 3}, + {&noMktexmfOpt, 3}, + {&noSpecialsOpt, 3}, + {&traceAllOpt, 3}, + {&colorOpt, 4}, + {&helpOpt, 4}, + {&listSpecialsOpt, 4}, + {&progressOpt, 4}, + {&verbosityOpt, 4}, + {&versionOpt, 4}, + }; +}; + +#endif + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.cpp index e679e7469da..b0bd0bd1f49 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.cpp @@ -2,7 +2,7 @@ ** DLLoader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,7 +19,7 @@ *************************************************************************/ #include <config.h> -#include "DLLoader.h" +#include "DLLoader.hpp" DLLoader::DLLoader (const char *dlname) : _handle(0) diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.hpp index 5a5b27271d9..6cedd193abc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** DLLoader.h ** +** DLLoader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,8 +18,8 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_DLLOADER_H -#define DVISVGM_DLLOADER_H +#ifndef DLLOADER_HPP +#define DLLOADER_HPP #ifdef _WIN32 #include <windows.h> diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.hpp index 5e3254656bf..fa3228d1473 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** DVIActions.h ** +** DVIActions.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,12 +18,11 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_DVIACTIONS_H -#define DVISVGM_DVIACTIONS_H +#ifndef DVIACTIONS_HPP +#define DVIACTIONS_HPP #include <string> #include <vector> -#include "types.h" class BoundingBox; class Font; @@ -31,7 +30,7 @@ class Font; struct DVIActions { - virtual ~DVIActions () {} + virtual ~DVIActions () =default; virtual void setChar (double x, double y, unsigned c, bool vertical, const Font &f) {} virtual void setRule (double x, double y, double height, double width) {} virtual void setTextOrientation (bool vertical) {} @@ -39,7 +38,7 @@ struct DVIActions virtual void moveToY (double y) {} virtual void setFont (int num, const Font &font) {} virtual void special (const std::string &s, double dvi2bp, bool preprocessing=false) {} - virtual void beginPage (unsigned pageno, const std::vector<Int32> &c) {} + virtual void beginPage (unsigned pageno, const std::vector<int32_t> &c) {} virtual void endPage (unsigned pageno) {} virtual BoundingBox& bbox () =0; virtual void progress (size_t current, size_t total, const char *id=0) {} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp index 3c6c2c1d284..4c94d3edf7a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp @@ -2,7 +2,7 @@ ** DVIReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -23,12 +23,12 @@ #include <cstdarg> #include <fstream> #include <sstream> -#include "Color.h" -#include "DVIActions.h" -#include "DVIReader.h" -#include "Font.h" -#include "FontManager.h" -#include "VectorStream.h" +#include "Color.hpp" +#include "DVIActions.hpp" +#include "DVIReader.hpp" +#include "Font.hpp" +#include "FontManager.hpp" +#include "VectorStream.hpp" using namespace std; @@ -47,7 +47,6 @@ DVIReader::DVIReader (istream &is) : BasicDVIReader(is) int DVIReader::executeCommand () { - _prevDviState = _currDviState; int opcode = BasicDVIReader::executeCommand(); return opcode; } @@ -79,10 +78,10 @@ bool DVIReader::executePage (unsigned n) { if (n < 1 || n > numberOfPages()) return false; - seek(_bopOffsets[n-1]); // goto bop of n-th page - _inPostamble = false; // not in postamble + seek(_bopOffsets[n-1]); // goto bop of n-th page + _inPostamble = false; // not in postamble _currPageNum = n; - while (executeCommand() != 140); // 140 == eop + while (executeCommand() != OP_EOP); return true; } @@ -91,7 +90,7 @@ void DVIReader::executePreamble () { clearStream(); if (isStreamValid()) { seek(0); - if (readByte() == 247) { + if (readByte() == OP_PRE) { cmdPre(0); return; } @@ -101,42 +100,42 @@ void DVIReader::executePreamble () { /** Moves stream pointer to begin of postamble */ -static void to_postamble (StreamReader &reader) { - reader.clearStream(); - if (!reader.isStreamValid()) +void DVIReader::goToPostamble () { + clearStream(); + if (!isStreamValid()) throw DVIException("invalid DVI file"); - reader.seek(-1, ios::end); // stream pointer to last byte + seek(-1, ios::end); // stream pointer to last byte int count=0; - while (reader.peek() == 223) { - reader.seek(-1, ios::cur); // skip fill bytes + while (peek() == DVI_FILL) { // skip fill bytes + seek(-1, ios::cur); count++; } if (count < 4) // the standard requires at least 4 trailing fill bytes throw DVIException("missing fill bytes at end of file"); - reader.seek(-4, ios::cur); // now on first byte of q (pointer to begin of postamble) - UInt32 q = reader.readUnsigned(4); // pointer to begin of postamble - reader.seek(q); // now on begin of postamble + seek(-4, ios::cur); // now at first byte of q (pointer to begin of postamble) + uint32_t q = readUnsigned(4); // pointer to begin of postamble + seek(q); // now at begin of postamble } /** Reads and executes the commands of the postamble. */ void DVIReader::executePostamble () { - to_postamble(*this); - while (executeCommand() != 249); // executes all commands until post_post (= 249) is reached + goToPostamble(); + while (executeCommand() != OP_POSTPOST); // executes all commands until post_post (= 249) is reached } /** Collects and records the file offsets of all bop commands. */ void DVIReader::collectBopOffsets () { - to_postamble(*this); - _bopOffsets.push_back(tell()); // also add offset of postamble - readByte(); // skip post command - UInt32 offset = readUnsigned(4); // offset of final bop - while ((Int32)offset > 0) { // not yet on first bop? - _bopOffsets.push_back(offset); // record offset - seek(offset+41); // skip bop command and the 10 \count values => now on offset of previous bop + goToPostamble(); + _bopOffsets.push_back(tell()); // also add offset of postamble + readByte(); // skip post command + uint32_t offset = readUnsigned(4); // offset of final bop + while ((int32_t)offset > 0) { // not yet on first bop? + _bopOffsets.push_back(offset); // record offset + seek(offset+41); // skip bop command and the 10 \count values => now on offset of previous bop offset = readUnsigned(4); } reverse(_bopOffsets.begin(), _bopOffsets.end()); @@ -147,14 +146,14 @@ void DVIReader::collectBopOffsets () { /** Reads and executes DVI preamble command. * Format: pre ver[1] num[4] den[4] mag[4] cmtlen[1] cmt[cmtlen] */ void DVIReader::cmdPre (int) { - UInt8 id = readUnsigned(1); - setDVIVersion(DVIVersion(id)); // identification number - UInt32 numer = readUnsigned(4); // numerator units of measurement - UInt32 denom = readUnsigned(4); // denominator units of measurement + uint8_t id = readUnsigned(1); + setDVIVersion(DVIVersion(id)); // identification number + uint32_t numer = readUnsigned(4); // numerator units of measurement + uint32_t denom = readUnsigned(4); // denominator units of measurement if (denom == 0) throw DVIException("denominator of measurement unit is zero"); _mag = readUnsigned(4); // magnification - UInt32 k = readUnsigned(1); // length of following comment + uint32_t k = readUnsigned(1); // length of following comment string comment = readString(k); // 1 dviunit * num/den == multiples of 0.0000001m // 1 dviunit * _dvibp: length of 1 dviunit in PS points * _mag/1000 @@ -166,16 +165,16 @@ void DVIReader::cmdPre (int) { /** Reads and executes DVI postamble command. * Format: post p[4] num[4] den[4] mag[4] ph[4] pw[4] sd[2] np[2] */ void DVIReader::cmdPost (int) { - UInt32 prevBopOffset = readUnsigned(4); - UInt32 numer = readUnsigned(4); - UInt32 denom = readUnsigned(4); + uint32_t prevBopOffset = readUnsigned(4); + uint32_t numer = readUnsigned(4); + uint32_t denom = readUnsigned(4); if (denom == 0) throw DVIException("denominator of measurement unit is zero"); _mag = readUnsigned(4); - UInt32 pageHeight = readUnsigned(4); // height of tallest page in dvi units - UInt32 pageWidth = readUnsigned(4); // width of widest page in dvi units - UInt16 stackDepth = readUnsigned(2); // max. stack depth required - UInt16 numPages = readUnsigned(2); + uint32_t pageHeight = readUnsigned(4); // height of tallest page in dvi units + uint32_t pageWidth = readUnsigned(4); // width of widest page in dvi units + uint16_t stackDepth = readUnsigned(2); // max. stack depth required + uint16_t numPages = readUnsigned(2); if (numPages != numberOfPages()) throw DVIException("page count in postamble doesn't match actual number of pages"); @@ -191,10 +190,10 @@ void DVIReader::cmdPost (int) { * Format: post_post q[4] i[1] 223[>=4] */ void DVIReader::cmdPostPost (int) { _inPostamble = false; - UInt32 postOffset = readUnsigned(4); // pointer to begin of postamble - UInt8 id = readUnsigned(1); - setDVIVersion(DVIVersion(id)); // identification byte - while (readUnsigned(1) == 223); // skip fill bytes (223), eof bit should be set now + uint32_t postOffset = readUnsigned(4); // pointer to begin of postamble + uint8_t id = readUnsigned(1); + setDVIVersion(DVIVersion(id)); // identification byte + while (readUnsigned(1) == DVI_FILL); // skip fill bytes (223), eof bit should be set now dviPostPost(DVIVersion(id), postOffset); } @@ -202,11 +201,11 @@ void DVIReader::cmdPostPost (int) { /** Reads and executes Begin-Of-Page command. * Format: bop c0[+4] ... c9[+4] p[+4] */ void DVIReader::cmdBop (int) { - vector<Int32> c(10); + vector<int32_t> c(10); for (int i=0; i < 10; i++) c[i] = readSigned(4); - Int32 prevBopOffset = readSigned(4); // pointer to peceeding bop (-1 in case of first page) - _currDviState.reset(); // set all DVI registers to 0 + int32_t prevBopOffset = readSigned(4); // pointer to peceeding bop (-1 in case of first page) + _dviState.reset(); // set all DVI registers to 0 while (!_stateStack.empty()) _stateStack.pop(); _currFontNum = 0; @@ -226,7 +225,7 @@ void DVIReader::cmdEop (int) { /** Reads and executes push command. */ void DVIReader::cmdPush (int) { - _stateStack.push(_currDviState); + _stateStack.push(_dviState); dviPush(); } @@ -235,7 +234,7 @@ void DVIReader::cmdPush (int) { void DVIReader::cmdPop (int) { if (_stateStack.empty()) throw DVIException("stack empty at pop command"); - _currDviState = _stateStack.top(); + _dviState = _stateStack.top(); _stateStack.pop(); dviPop(); } @@ -245,19 +244,19 @@ void DVIReader::cmdPop (int) { * It is called by the cmdSetChar and cmdPutChar methods. * @param[in] font current font (corresponding to _currFontNum) * @param[in] c character to typeset */ -void DVIReader::putVFChar (Font *font, UInt32 c) { +void DVIReader::putVFChar (Font *font, uint32_t c) { if (VirtualFont *vf = dynamic_cast<VirtualFont*>(font)) { // is current font a virtual font? - if (const vector<UInt8> *dvi = vf->getDVI(c)) { // try to get DVI snippet that represents character c + if (const vector<uint8_t> *dvi = vf->getDVI(c)) { // try to get DVI snippet that represents character c FontManager &fm = FontManager::instance(); - DVIState pos = _currDviState; // save current cursor position - _currDviState.x = _currDviState.y = _currDviState.w = _currDviState.z = 0; + DVIState savedState = _dviState; // save current cursor position + _dviState.x = _dviState.y = _dviState.w = _dviState.z = 0; int savedFontNum = _currFontNum; // save current font number fm.enterVF(vf); // enter VF font number context - setFont(fm.vfFirstFontNum(vf), VF_ENTER); + setFont(fm.vfFirstFontNum(vf), SetFontMode::VF_ENTER); double savedScale = _dvi2bp; // DVI units in virtual fonts are multiples of 1^(-20) times the scaled size of the VF _dvi2bp = vf->scaledSize()/(1 << 20); - VectorInputStream<UInt8> vis(*dvi); + VectorInputStream<uint8_t> vis(*dvi); istream &is = replaceStream(vis); try { executeAll(); // execute DVI fragment @@ -265,11 +264,11 @@ void DVIReader::putVFChar (Font *font, UInt32 c) { catch (const DVIException &e) { // Message::estream(true) << "invalid dvi in vf: " << e.getMessage() << endl; // @@ } - replaceStream(is); // restore previous input stream - _dvi2bp = savedScale; // restore previous scale factor - fm.leaveVF(); // restore previous font number context - setFont(savedFontNum, VF_LEAVE); // restore previous font number - _currDviState = pos; // restore previous cursor position + replaceStream(is); // restore previous input stream + _dvi2bp = savedScale; // restore previous scale factor + fm.leaveVF(); // restore previous font number context + setFont(savedFontNum, SetFontMode::VF_LEAVE); // restore previous font number + _dviState = savedState; // restore previous cursor position } } } @@ -283,9 +282,9 @@ void DVIReader::cmdSetChar0 (int c) { if (!_inPage) throw DVIException("setchar outside of page"); Font *font = FontManager::instance().getFont(_currFontNum); + dviSetChar0(c, font); // template method that may trigger further actions + putVFChar(font, c); // further character processing if current font is a virtual font moveRight(font->charWidth(c)*font->scaleFactor()*_mag/1000.0); - dviSetChar0(c, font); - putVFChar(font, c); } @@ -298,11 +297,11 @@ void DVIReader::cmdSetChar (int len) { throw DVIException("setchar outside of page"); // According to the dvi specification all character codes are unsigned // except len == 4. At the moment all char codes are treated as unsigned... - UInt32 c = readUnsigned(len); // if len == 4 c may be signed + uint32_t c = readUnsigned(len); // if len == 4 c may be signed Font *font = FontManager::instance().getFont(_currFontNum); + dviSetChar(c, font); // template method that may trigger further actions + putVFChar(font, c); // further character processing if current font is a virtual font moveRight(font->charWidth(c)*font->scaleFactor()*_mag/1000.0); - dviSetChar(c, font); - putVFChar(font, c); } @@ -315,7 +314,7 @@ void DVIReader::cmdPutChar (int len) { throw DVIException("putchar outside of page"); // According to the dvi specification all character codes are unsigned // except len == 4. At the moment all char codes are treated as unsigned... - Int32 c = readUnsigned(len); + int32_t c = readUnsigned(len); Font *font = FontManager::instance().getFont(_currFontNum); dviPutChar(c, font); putVFChar(font, c); @@ -331,8 +330,8 @@ void DVIReader::cmdSetRule (int) { throw DVIException("set_rule outside of page"); double height = _dvi2bp*readSigned(4); double width = _dvi2bp*readSigned(4); - moveRight(width); dviSetRule(height, width); + moveRight(width); } @@ -350,71 +349,71 @@ void DVIReader::cmdPutRule (int) { void DVIReader::moveRight (double dx) { - switch (_currDviState.d) { - case WMODE_LR: _currDviState.h += dx; break; - case WMODE_TB: _currDviState.v += dx; break; - case WMODE_BT: _currDviState.v -= dx; break; + switch (_dviState.d) { + case WritingMode::LR: _dviState.h += dx; break; + case WritingMode::TB: _dviState.v += dx; break; + case WritingMode::BT: _dviState.v -= dx; break; } } void DVIReader::moveDown (double dy) { - switch (_currDviState.d) { - case WMODE_LR: _currDviState.v += dy; break; - case WMODE_TB: _currDviState.h -= dy; break; - case WMODE_BT: _currDviState.h += dy; break; + switch (_dviState.d) { + case WritingMode::LR: _dviState.v += dy; break; + case WritingMode::TB: _dviState.h -= dy; break; + case WritingMode::BT: _dviState.h += dy; break; } } void DVIReader::cmdRight (int len) { - Int32 dx = _dvi2bp*readSigned(len); + double dx = _dvi2bp*readSigned(len); moveRight(dx); dviRight(dx); } void DVIReader::cmdDown (int len) { - Int32 dy = _dvi2bp*readSigned(len); + double dy = _dvi2bp*readSigned(len); moveDown(dy); dviDown(dy); } -void DVIReader::cmdNop (int) {} -void DVIReader::cmdX0 (int) {moveRight(_currDviState.x); dviX0();} -void DVIReader::cmdY0 (int) {moveDown(_currDviState.y); dviY0();} -void DVIReader::cmdW0 (int) {moveRight(_currDviState.w); dviW0();} -void DVIReader::cmdZ0 (int) {moveDown(_currDviState.z); dviZ0();} +void DVIReader::cmdNop (int) {dviNop();} +void DVIReader::cmdX0 (int) {moveRight(_dviState.x); dviX0();} +void DVIReader::cmdY0 (int) {moveDown(_dviState.y); dviY0();} +void DVIReader::cmdW0 (int) {moveRight(_dviState.w); dviW0();} +void DVIReader::cmdZ0 (int) {moveDown(_dviState.z); dviZ0();} void DVIReader::cmdX (int len) { - Int32 dx = _dvi2bp*readSigned(len); - _currDviState.x = dx; + double dx = _dvi2bp*readSigned(len); + _dviState.x = dx; moveRight(dx); dviX(dx); } void DVIReader::cmdY (int len) { - Int32 dy = _dvi2bp*readSigned(len); - _currDviState.y = dy; + double dy = _dvi2bp*readSigned(len); + _dviState.y = dy; moveDown(dy); dviY(dy); } void DVIReader::cmdW (int len) { - Int32 dx = _dvi2bp*readSigned(len); - _currDviState.w = dx; + double dx = _dvi2bp*readSigned(len); + _dviState.w = dx; moveRight(dx); dviW(dx); } void DVIReader::cmdZ (int len) { - Int32 dy = _dvi2bp*readSigned(len); - _currDviState.z = dy; + double dy = _dvi2bp*readSigned(len); + _dviState.z = dy; moveDown(dy); dviZ(dy); } @@ -423,7 +422,7 @@ void DVIReader::cmdZ (int len) { /** Sets the text orientation (horizontal, vertical). * This command is only available in DVI version 3 (created by pTeX) */ void DVIReader::cmdDir (int) { - UInt8 wmode = readUnsigned(1); + uint8_t wmode = readUnsigned(1); if (wmode == 4) // yoko mode (4) equals default LR mode (0) wmode = 0; if (wmode == 2 || wmode > 3) { @@ -431,15 +430,15 @@ void DVIReader::cmdDir (int) { oss << "invalid writing mode value " << wmode << " (0, 1, 3, or 4 expected)"; throw DVIException(oss.str()); } - _currDviState.d = (WritingMode)wmode; - dviDir(_currDviState.d); + _dviState.d = (WritingMode)wmode; + dviDir(_dviState.d); } void DVIReader::cmdXXX (int len) { if (!_inPage) throw DVIException("special outside of page"); - UInt32 numBytes = readUnsigned(len); + uint32_t numBytes = readUnsigned(len); string str = readString(numBytes); dviXXX(str); } @@ -452,7 +451,7 @@ void DVIReader::cmdXXX (int len) { void DVIReader::setFont (int fontnum, SetFontMode mode) { if (const Font *font = FontManager::instance().getFont(fontnum)) { _currFontNum = fontnum; - dviFontNum(UInt32(fontnum), mode, font); + dviFontNum(uint32_t(fontnum), mode, font); } else { ostringstream oss; @@ -466,7 +465,7 @@ void DVIReader::setFont (int fontnum, SetFontMode mode) { * @param[in] fontnum font number * @throw DVIException if font number is undefined */ void DVIReader::cmdFontNum0 (int fontnum) { - setFont(fontnum, SF_SHORT); + setFont(fontnum, SetFontMode::SF_SHORT); } @@ -474,8 +473,8 @@ void DVIReader::cmdFontNum0 (int fontnum) { * @param[in] len size of font number variable (in bytes) * @throw DVIException if font number is undefined */ void DVIReader::cmdFontNum (int len) { - UInt32 fontnum = readUnsigned(len); - setFont(fontnum, SF_LONG); + uint32_t fontnum = readUnsigned(len); + setFont(fontnum, SetFontMode::SF_LONG); } @@ -485,7 +484,7 @@ void DVIReader::cmdFontNum (int len) { * @param[in] cs checksum to be compared with TFM checksum * @param[in] ds design size in PS point units * @param[in] ss scaled size in PS point units */ -const Font* DVIReader::defineFont (UInt32 fontnum, const string &name, UInt32 cs, double ds, double ss) { +const Font* DVIReader::defineFont (uint32_t fontnum, const string &name, uint32_t cs, double ds, double ss) { FontManager &fm = FontManager::instance(); Font *font = fm.getFont(fontnum); if (!font) { @@ -508,15 +507,15 @@ const Font* DVIReader::defineFont (UInt32 fontnum, const string &name, UInt32 cs /** Defines a new font. * @param[in] len size of font number variable (in bytes) */ void DVIReader::cmdFontDef (int len) { - UInt32 fontnum = readUnsigned(len); // font number - UInt32 checksum = readUnsigned(4); // font checksum (to be compared with corresponding TFM checksum) - UInt32 ssize = readUnsigned(4); // scaled size of font in DVI units - UInt32 dsize = readUnsigned(4); // design size of font in DVI units - UInt32 pathlen = readUnsigned(1); // length of font path - UInt32 namelen = readUnsigned(1); // length of font name - string path = readString(pathlen); // path to font file - string fontname = readString(namelen); - const Font *font = defineFont(fontnum, fontname, checksum, dsize*_dvi2bp, ssize*_dvi2bp); + uint32_t fontnum = readUnsigned(len); // font number + uint32_t checksum = readUnsigned(4); // font checksum (to be compared with corresponding TFM checksum) + uint32_t ssize = readUnsigned(4); // scaled size of font in DVI units + uint32_t dsize = readUnsigned(4); // design size of font in DVI units + uint32_t pathlen = readUnsigned(1); // length of font path + uint32_t namelen = readUnsigned(1); // length of font name + string path = readString(pathlen); // path to font file + string fontname = readString(namelen); + const Font *font = defineFont(fontnum, fontname, checksum, dsize*_dvi2bp, ssize*_dvi2bp); dviFontDef(fontnum, checksum, font); } @@ -528,7 +527,7 @@ void DVIReader::cmdFontDef (int len) { * @param[in] checksum checksum to be compared with TFM checksum * @param[in] dsize design size in PS point units * @param[in] ssize scaled size in PS point units */ -void DVIReader::defineVFFont (UInt32 fontnum, string path, string name, UInt32 checksum, double dsize, double ssize) { +void DVIReader::defineVFFont (uint32_t fontnum, const string &path, const string &name, uint32_t checksum, double dsize, double ssize) { if (const VirtualFont *vf = FontManager::instance().getVF()) defineFont(fontnum, name, checksum, dsize, ssize * vf->scaleFactor()); } @@ -537,20 +536,20 @@ void DVIReader::defineVFFont (UInt32 fontnum, string path, string name, UInt32 c /** This template method is called by the VFReader after reading a character definition from a VF file. * @param[in] c character number * @param[in] dvi DVI fragment describing the character */ -void DVIReader::defineVFChar (UInt32 c, vector<UInt8> *dvi) { - FontManager::instance().assignVfChar(c, dvi); +void DVIReader::defineVFChar (uint32_t c, vector<uint8_t> &&dvi) { + FontManager::instance().assignVFChar(c, std::move(dvi)); } /** XDV extension: includes image or pdf file. * parameters: box[1] matrix[4][6] p[2] len[2] path[l] */ void DVIReader::cmdXPic (int) { - UInt8 box = readUnsigned(1); // box - vector<Int32> matrix(6); + uint8_t box = readUnsigned(1); // box + vector<int32_t> matrix(6); for (int i=0; i < 6; i++) // matrix matrix[i] = readSigned(4); - Int16 page = readSigned(2); // page number - UInt16 len = readUnsigned(2); + int16_t page = readSigned(2); // page number + uint16_t len = readUnsigned(2); string path = readString(len); // path to image/pdf file dviXPic(box, matrix, page, path); } @@ -558,14 +557,14 @@ void DVIReader::cmdXPic (int) { /** XDV extension: defines a native font */ void DVIReader::cmdXFontDef (int) { - Int32 fontnum = readSigned(4); + int32_t fontnum = readSigned(4); double ptsize = _dvi2bp*readUnsigned(4); - UInt16 flags = readUnsigned(2); - UInt8 psname_len = readUnsigned(1); - UInt8 fmname_len = getDVIVersion() == DVI_XDV5 ? readUnsigned(1) : 0; // length of family name - UInt8 stname_len = getDVIVersion() == DVI_XDV5 ? readUnsigned(1) : 0; // length of style name + uint16_t flags = readUnsigned(2); + uint8_t psname_len = readUnsigned(1); + uint8_t fmname_len = getDVIVersion() == DVI_XDV5 ? readUnsigned(1) : 0; // length of family name + uint8_t stname_len = getDVIVersion() == DVI_XDV5 ? readUnsigned(1) : 0; // length of style name string fontname = readString(psname_len); - UInt32 fontIndex=0; + uint32_t fontIndex=0; if (getDVIVersion() == DVI_XDV5) seek(fmname_len+stname_len, ios::cur); else @@ -578,8 +577,8 @@ void DVIReader::cmdXFontDef (int) { // The font color must not interfere with color specials. If the font color is not black, // all color specials should be ignored, i.e. glyphs of a non-black fonts have a fixed color // that can't be changed by color specials. - UInt32 rgba = readUnsigned(4); - color.setRGB(UInt8(rgba >> 24), UInt8((rgba >> 16) & 0xff), UInt8((rgba >> 8) & 0xff)); + uint32_t rgba = readUnsigned(4); + color.setRGB(uint8_t(rgba >> 24), uint8_t((rgba >> 16) & 0xff), uint8_t((rgba >> 8) & 0xff)); } if (flags & 0x1000) // extend? style.extend = _dvi2bp*readSigned(4); @@ -588,7 +587,7 @@ void DVIReader::cmdXFontDef (int) { if (flags & 0x4000) // embolden? style.bold = _dvi2bp*readSigned(4); if ((flags & 0x0800) && (getDVIVersion() == DVI_XDV5)) { // variations? - UInt16 num_variations = readSigned(2); + uint16_t num_variations = readSigned(2); for (int i=0; i < num_variations; i++) readUnsigned(4); } @@ -606,12 +605,13 @@ void DVIReader::cmdXFontDef (int) { * parameters: w[4] n[2] (dx,dy)[(4+4)n] glyphs[2n] */ void DVIReader::cmdXGlyphArray (int) { vector<double> dx, dy; - vector<UInt16> glyphs; - putGlyphArray(false, dx, dy, glyphs); + vector<uint16_t> glyphs; + double width = putGlyphArray(false, dx, dy, glyphs); if (Font *font = FontManager::instance().getFont(_currFontNum)) dviXGlyphArray(dx, dy, glyphs, *font); else throw DVIException("missing setfont prior to xglypharray"); + moveRight(width); } @@ -620,12 +620,13 @@ void DVIReader::cmdXGlyphArray (int) { * parameters: w[4] n[2] dx[4n] dy[4] glyphs[2n] */ void DVIReader::cmdXGlyphString (int) { vector<double> dx, dy; - vector<UInt16> glyphs; - putGlyphArray(true, dx, dy, glyphs); + vector<uint16_t> glyphs; + double width = putGlyphArray(true, dx, dy, glyphs); if (Font *font = FontManager::instance().getFont(_currFontNum)) dviXGlyphString(dx, glyphs, *font); else throw DVIException("missing setfont prior to xglyphstring"); + moveRight(width); } @@ -636,17 +637,18 @@ void DVIReader::cmdXGlyphString (int) { * introduced with XeTeX 0.99995 and can be triggered by <tt>\\XeTeXgenerateactualtext1</tt>. * parameters: l[2] chars[2l] w[4] n[2] (dx,dy)[8n] glyphs[2n] */ void DVIReader::cmdXTextAndGlyphs (int) { - UInt16 l = readUnsigned(2); // number of chars - vector<UInt16> chars(l); + uint16_t l = readUnsigned(2); // number of chars + vector<uint16_t> chars(l); for (int i=0; i < l; i++) chars[i] = readUnsigned(2); vector<double> x, y; - vector<UInt16> glyphs; - putGlyphArray(false, x, y, glyphs); + vector<uint16_t> glyphs; + double width = putGlyphArray(false, x, y, glyphs); if (Font *font = FontManager::instance().getFont(_currFontNum)) dviXTextAndGlyphs(x, y, chars, glyphs, *font); else throw DVIException("missing setfont prior to xtextandglyphs"); + moveRight(width); } @@ -654,10 +656,11 @@ void DVIReader::cmdXTextAndGlyphs (int) { * @param[in] xonly indicates if the characters share a single y coordinate (xonly==true) * @param[out] dx relative horizontal positions of each glyph * @param[out] dy relative vertical positions of each glyph - * @param[out] glyphs FreeType indices of the glyphs to typeset */ -void DVIReader::putGlyphArray (bool xonly, vector<double> &dx, vector<double> &dy, vector<UInt16> &glyphs) { + * @param[out] glyphs FreeType indices of the glyphs to typeset + * @return total width of the glyph array */ +double DVIReader::putGlyphArray (bool xonly, vector<double> &dx, vector<double> &dy, vector<uint16_t> &glyphs) { double strwidth = _dvi2bp*readSigned(4); - UInt16 num_glyphs = readUnsigned(2); + uint16_t num_glyphs = readUnsigned(2); dx.resize(num_glyphs); dy.resize(num_glyphs); glyphs.resize(num_glyphs); @@ -667,5 +670,5 @@ void DVIReader::putGlyphArray (bool xonly, vector<double> &dx, vector<double> &d } for (int i=0; i < num_glyphs; i++) glyphs[i] = readUnsigned(2); - moveRight(strwidth); + return strwidth; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.hpp index 97d297adc55..cd66c0e5681 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** DVIReader.h ** +** DVIReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,17 +18,16 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_DVIREADER_H -#define DVISVGM_DVIREADER_H +#ifndef DVIREADER_HPP +#define DVIREADER_HPP #include <limits> #include <map> #include <stack> #include <string> -#include "BasicDVIReader.h" -#include "Color.h" -#include "VFActions.h" -#include "types.h" +#include "BasicDVIReader.hpp" +#include "Color.hpp" +#include "VFActions.hpp" class Font; class FontStyle; @@ -38,8 +37,8 @@ class VirtualFont; class DVIReader : public BasicDVIReader, public VFActions { protected: - enum WritingMode {WMODE_LR=0, WMODE_TB=1, WMODE_BT=3}; - enum SetFontMode {SF_SHORT, SF_LONG, VF_ENTER, VF_LEAVE}; + enum class WritingMode {LR=0, TB=1, BT=3}; + enum class SetFontMode {SF_SHORT, SF_LONG, VF_ENTER, VF_LEAVE}; struct DVIState { @@ -47,7 +46,7 @@ class DVIReader : public BasicDVIReader, public VFActions double x, w, y, z; ///< additional registers to store horizontal (x, w) and vertical (y, z) positions WritingMode d; ///< direction: 0: horizontal, 1: vertical(top->bottom), 3: vertical (bottom->top) DVIState () {reset();} - void reset () {h = v = x = w = y = z = 0.0; d=WMODE_LR;} + void reset () {h = v = x = w = y = z = 0.0; d=WritingMode::LR;} }; public: @@ -57,46 +56,46 @@ class DVIReader : public BasicDVIReader, public VFActions void executePreamble (); void executePostamble (); bool executePage (unsigned n); - bool inPostamble () const {return _inPostamble;} - double getXPos () const {return _currDviState.h;} - double getYPos () const {return _currDviState.v;} - int stackDepth () const {return _stateStack.size();} - int currentFontNumber () const {return _currFontNum;} - unsigned currentPageNumber () const {return _currPageNum;} - unsigned numberOfPages () const {return _bopOffsets.empty() ? 0 : _bopOffsets.size()-1;} + bool inPostamble () const {return _inPostamble;} + double getXPos () const override {return _dviState.h;} + double getYPos () const override {return _dviState.v;} + int stackDepth () const override {return _stateStack.size();} + int currentFontNumber () const {return _currFontNum;} + unsigned currentPageNumber () const override {return _currPageNum;} + unsigned numberOfPages () const {return _bopOffsets.empty() ? 0 : _bopOffsets.size()-1;} protected: - int executeCommand (); + int executeCommand () override; void collectBopOffsets (); size_t numberOfPageBytes (int n) const {return _bopOffsets.size() > 1 ? _bopOffsets[n+1]-_bopOffsets[n] : 0;} + void goToPostamble (); virtual void moveRight (double dx); virtual void moveDown (double dy); - void putVFChar (Font *font, UInt32 c); - void putGlyphArray (bool xonly, std::vector<double> &dx, std::vector<double> &dy, std::vector<UInt16> &glyphs); - const Font* defineFont (UInt32 fontnum, const std::string &name, UInt32 cs, double ds, double ss); + void putVFChar (Font *font, uint32_t c); + double putGlyphArray (bool xonly, std::vector<double> &dx, std::vector<double> &dy, std::vector<uint16_t> &glyphs); + const Font* defineFont (uint32_t fontnum, const std::string &name, uint32_t cs, double ds, double ss); void setFont (int num, SetFontMode mode); - const DVIState& currState() const {return _currDviState;} - const DVIState& prevState() const {return _prevDviState;} + const DVIState& dviState() const {return _dviState;} double dvi2bp () const {return _dvi2bp;} bool inPage () const {return _inPage;} // VFAction methods - void defineVFFont (UInt32 fontnum, std::string path, std::string name, UInt32 checksum, double dsize, double ssize); - void defineVFChar (UInt32 c, std::vector<UInt8> *dvi); + void defineVFFont (uint32_t fontnum, const std::string &path, const std::string &name, uint32_t checksum, double dsize, double ssize) override; + void defineVFChar (uint32_t c, std::vector<uint8_t> &&dvi) override; // The following template methods provide higher-level access to the DVI commands. // In contrast to their cmdXXX pendants, they don't require any handling of the input stream. // All command arguments are delivered as function parameters. These methods are called after // the DVI registers have been updated, i.e. currState() represents the state after executing // the command. If the previous register state is required, prevState() can be used. - virtual void dviPre (UInt8 id, UInt32 numer, UInt32 denom, UInt32 mag, const std::string &comment) {} - virtual void dviPost (UInt16 stdepth, UInt16 pages, UInt32 pw, UInt32 ph, UInt32 mag, UInt32 num, UInt32 den, UInt32 lbopofs) {} - virtual void dviPostPost (UInt8 id, UInt32 postOffset) {} - virtual void dviBop (const std::vector<Int32> &c, Int32 prevBopOffset) {} + virtual void dviPre (uint8_t id, uint32_t numer, uint32_t denom, uint32_t mag, const std::string &comment) {} + virtual void dviPost (uint16_t stdepth, uint16_t pages, uint32_t pw, uint32_t ph, uint32_t mag, uint32_t num, uint32_t den, uint32_t lbopofs) {} + virtual void dviPostPost (uint8_t id, uint32_t postOffset) {} + virtual void dviBop (const std::vector<int32_t> &c, int32_t prevBopOffset) {} virtual void dviEop () {} - virtual void dviSetChar0 (UInt32 c, const Font *font) {} - virtual void dviSetChar (UInt32 c, const Font *font) {} - virtual void dviPutChar (UInt32 c, const Font *font) {} + virtual void dviSetChar0 (uint32_t c, const Font *font) {} + virtual void dviSetChar (uint32_t c, const Font *font) {} + virtual void dviPutChar (uint32_t c, const Font *font) {} virtual void dviSetRule (double h, double w) {} virtual void dviPutRule (double h, double w) {} virtual void dviNop () {} @@ -112,64 +111,63 @@ class DVIReader : public BasicDVIReader, public VFActions virtual void dviY (double y) {} virtual void dviW (double w) {} virtual void dviZ (double z) {} - virtual void dviFontDef (UInt32 fontnum, UInt32 checksum, const Font *font) {} - virtual void dviFontNum (UInt32 fontnum, SetFontMode mode, const Font *font) {} + virtual void dviFontDef (uint32_t fontnum, uint32_t checksum, const Font *font) {} + virtual void dviFontNum (uint32_t fontnum, SetFontMode mode, const Font *font) {} virtual void dviDir (WritingMode dir) {} virtual void dviXXX (const std::string &str) {} - virtual void dviXPic (UInt8 box, const std::vector<Int32> &matrix, Int16 page, const std::string &path) {} - virtual void dviXFontDef (UInt32 fontnum, const NativeFont *font) {} - virtual void dviXGlyphArray (std::vector<double> &dx, std::vector<double> &dy, std::vector<UInt16> &glyphs, const Font &font) {} - virtual void dviXGlyphString (std::vector<double> &dx, std::vector<UInt16> &glyphs, const Font &font) {} - virtual void dviXTextAndGlyphs (std::vector<double> &dx, std::vector<double> &dy, std::vector<UInt16> &chars, std::vector<UInt16> &glyphs, const Font &font) {} + virtual void dviXPic (uint8_t box, const std::vector<int32_t> &matrix, int16_t page, const std::string &path) {} + virtual void dviXFontDef (uint32_t fontnum, const NativeFont *font) {} + virtual void dviXGlyphArray (std::vector<double> &dx, std::vector<double> &dy, std::vector<uint16_t> &glyphs, const Font &font) {} + virtual void dviXGlyphString (std::vector<double> &dx, std::vector<uint16_t> &glyphs, const Font &font) {} + virtual void dviXTextAndGlyphs (std::vector<double> &dx, std::vector<double> &dy, std::vector<uint16_t> &chars, std::vector<uint16_t> &glyphs, const Font &font) {} private: // The following low-level methods evaluate the DVI commands read from // the input stream and call the corresponding dviXXX methods. - void cmdSetChar0 (int c); - void cmdSetChar (int len); - void cmdPutChar (int len); - void cmdSetRule (int len); - void cmdPutRule (int len); - void cmdNop (int len); - void cmdBop (int len); - void cmdEop (int len); - void cmdPush (int len); - void cmdPop (int len); - void cmdDir (int len); - void cmdRight (int len); - void cmdDown (int len); - void cmdX0 (int len); - void cmdY0 (int len); - void cmdW0 (int len); - void cmdZ0 (int len); - void cmdX (int len); - void cmdY (int len); - void cmdW (int len); - void cmdZ (int len); - void cmdFontDef (int len); - void cmdFontNum0 (int n); - void cmdFontNum (int len); - void cmdXXX (int len); - void cmdPre (int len); - void cmdPost (int len); - void cmdPostPost (int len); - void cmdXPic (int len); - void cmdXFontDef (int len); - void cmdXGlyphArray (int len); - void cmdXGlyphString (int len); - void cmdXTextAndGlyphs (int len); + void cmdSetChar0 (int c) override; + void cmdSetChar (int len) override; + void cmdPutChar (int len) override; + void cmdSetRule (int len) override; + void cmdPutRule (int len) override; + void cmdNop (int len) override; + void cmdBop (int len) override; + void cmdEop (int len) override; + void cmdPush (int len) override; + void cmdPop (int len) override; + void cmdDir (int len) override; + void cmdRight (int len) override; + void cmdDown (int len) override; + void cmdX0 (int len) override; + void cmdY0 (int len) override; + void cmdW0 (int len) override; + void cmdZ0 (int len) override; + void cmdX (int len) override; + void cmdY (int len) override; + void cmdW (int len) override; + void cmdZ (int len) override; + void cmdFontDef (int len) override; + void cmdFontNum0 (int n) override; + void cmdFontNum (int len) override; + void cmdXXX (int len) override; + void cmdPre (int len) override; + void cmdPost (int len) override; + void cmdPostPost (int len) override; + void cmdXPic (int len) override; + void cmdXFontDef (int len) override; + void cmdXGlyphArray (int len) override; + void cmdXGlyphString (int len) override; + void cmdXTextAndGlyphs (int len) override; private: bool _inPage; ///< true if stream pointer is between bop and eop unsigned _currPageNum; ///< current page number (1 is first page) int _currFontNum; ///< current font number double _dvi2bp; ///< factor to convert dvi units to PS points - UInt32 _mag; ///< magnification factor * 1000 + uint32_t _mag; ///< magnification factor * 1000 bool _inPostamble; ///< true if stream pointer is inside the postamble - DVIState _currDviState; ///< current state of the DVI registers - DVIState _prevDviState; ///< previous state of the DVI registers + DVIState _dviState; ///< current state of the DVI registers std::stack<DVIState> _stateStack; - std::vector<UInt32> _bopOffsets; + std::vector<uint32_t> _bopOffsets; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp index ed292354485..64a0e183b4a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp @@ -2,7 +2,7 @@ ** DVIToSVG.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -24,37 +24,38 @@ #include <fstream> #include <set> #include <sstream> -#include "Calculator.h" -#include "DVIToSVG.h" -#include "DVIToSVGActions.h" -#include "Font.h" -#include "FontManager.h" -#include "GlyphTracerMessages.h" -#include "InputBuffer.h" -#include "InputReader.h" -#include "PageRanges.h" -#include "PageSize.h" -#include "PreScanDVIReader.h" -#include "SignalHandler.h" -#include "SVGOutput.h" +#include "Calculator.hpp" +#include "DVIToSVG.hpp" +#include "DVIToSVGActions.hpp" +#include "Font.hpp" +#include "FontManager.hpp" +#include "GlyphTracerMessages.hpp" +#include "InputBuffer.hpp" +#include "InputReader.hpp" +#include "PageRanges.hpp" +#include "PageSize.hpp" +#include "PreScanDVIReader.hpp" +#include "SignalHandler.hpp" +#include "SVGOutput.hpp" +#include "version.hpp" /////////////////////////////////// // special handlers -#include "BgColorSpecialHandler.h" -#include "ColorSpecialHandler.h" -#include "DvisvgmSpecialHandler.h" -#include "EmSpecialHandler.h" -#include "HtmlSpecialHandler.h" -#include "PapersizeSpecialHandler.h" -#include "PdfSpecialHandler.h" +#include "BgColorSpecialHandler.hpp" +#include "ColorSpecialHandler.hpp" +#include "DvisvgmSpecialHandler.hpp" +#include "EmSpecialHandler.hpp" +#include "HtmlSpecialHandler.hpp" +#include "PapersizeSpecialHandler.hpp" +#include "PdfSpecialHandler.hpp" #ifndef HAVE_LIBGS - #include "NoPsSpecialHandler.h" + #include "NoPsSpecialHandler.hpp" #endif #ifndef DISABLE_GS - #include "PsSpecialHandler.h" + #include "PsSpecialHandler.hpp" #endif -#include "TpicSpecialHandler.h" +#include "TpicSpecialHandler.hpp" /////////////////////////////////// @@ -72,7 +73,8 @@ DVIToSVG::DVIToSVG (istream &is, SVGOutputBase &out) : DVIReader(is), _out(out) _pageHeight = _pageWidth = 0; _tx = _ty = 0; // no cursor translation _pageByte = 0; - _prevYPos = numeric_limits<double>::min(); + _prevXPos = _prevYPos = numeric_limits<double>::min(); + _prevWritingMode = WritingMode::LR; _actions = new DVIToSVGActions(*this, _svg); } @@ -97,14 +99,18 @@ void DVIToSVG::convert (unsigned first, unsigned last, pair<int,int> *pageinfo) throw DVIException(oss.str()); } last = min(last, numberOfPages()); - for (unsigned i=first; i <= last; ++i) { executePage(i); _svg.removeRedundantElements(); embedFonts(_svg.rootNode()); - _svg.write(_out.getPageStream(currentPageNumber(), numberOfPages())); + bool success = _svg.write(_out.getPageStream(currentPageNumber(), numberOfPages())); string fname = _out.filename(i, numberOfPages()); - Message::mstream(false, Message::MC_PAGE_WRITTEN) << "\noutput written to " << (fname.empty() ? "<stdout>" : fname) << '\n'; + if (fname.empty()) + fname = "<stdout>"; + if (success) + Message::mstream(false, Message::MC_PAGE_WRITTEN) << "\noutput written to " << fname << '\n'; + else + Message::wstream(true) << "failed to write output to " << fname << '\n'; _svg.reset(); static_cast<DVIToSVGActions*>(_actions)->reset(); } @@ -132,8 +138,8 @@ void DVIToSVG::convert (const string &rangestr, pair<int,int> *pageinfo) { SpecialManager::instance().notifyPreprocessingFinished(); } - FORALL(ranges, PageRanges::ConstIterator, it) - convert(it->first, it->second); + for (const auto &range : ranges) + convert(range.first, range.second); if (pageinfo) { pageinfo->first = ranges.numberOfPages(); pageinfo->second = numberOfPages(); @@ -145,10 +151,12 @@ int DVIToSVG::executeCommand () { SignalHandler::instance().check(); const streampos cmdpos = tell(); int opcode = DVIReader::executeCommand(); - if (currState().v+_ty != _prevYPos) { + if (dviState().v+_ty != _prevYPos) { _tx = _ty = 0; - _prevYPos = currState().v; + _prevYPos = dviState().v; } + _prevXPos = dviState().h+_tx; + _prevWritingMode = dviState().d; if (COMPUTE_PROGRESS && inPage() && _actions) { size_t pagelen = numberOfPageBytes(currentPageNumber()-1); _pageByte += tell()-cmdpos; @@ -162,14 +170,14 @@ int DVIToSVG::executeCommand () { * executing the BOP actions. * @param[in] pageno physical page number (1 = first page) * @param[in] c contains information about the page (page number etc.) */ -void DVIToSVG::enterBeginPage (unsigned pageno, const vector<Int32> &c) { +void DVIToSVG::enterBeginPage (unsigned pageno, const vector<int32_t> &c) { if (dynamic_cast<DVIToSVGActions*>(_actions)) { Message::mstream().indent(0); Message::mstream(false, Message::MC_PAGE_NUMBER) << "processing page " << pageno; if (pageno != (unsigned)c[0]) // Does page number shown on page differ from physical page number? Message::mstream(false) << " [" << c[0] << ']'; Message::mstream().indent(1); - _svg.appendToDoc(new XMLCommentNode(" This file was generated by dvisvgm " VERSION " ")); + _svg.appendToDoc(new XMLCommentNode(" This file was generated by dvisvgm " + string(PROGRAM_VERSION) + " ")); } } @@ -261,12 +269,11 @@ void DVIToSVG::getPageTransformation(Matrix &matrix) const { } -static void collect_chars (map<const Font*, set<int> > &fm) { - typedef const map<const Font*, set<int> > UsedCharsMap; - FORALL(fm, UsedCharsMap::const_iterator, it) { - if (it->first->uniqueFont() != it->first) { - FORALL(it->second, set<int>::const_iterator, cit) - fm[it->first->uniqueFont()].insert(*cit); +static void collect_chars (map<const Font*, set<int>> &fontmap) { + for (const auto &entry : fontmap) { + if (entry.first->uniqueFont() != entry.first) { + for (int c : entry.second) + fontmap[entry.first->uniqueFont()].insert(c); } } } @@ -280,16 +287,15 @@ void DVIToSVG::embedFonts (XMLElementNode *svgElement) { if (!_actions) // no dvi actions => no chars written => no fonts to embed return; - typedef map<const Font*, set<int> > UsedCharsMap; const DVIToSVGActions *svgActions = static_cast<DVIToSVGActions*>(_actions); - UsedCharsMap &usedChars = svgActions->getUsedChars(); + map<const Font*,set<int>> &usedCharsMap = svgActions->getUsedChars(); - collect_chars(usedChars); + collect_chars(usedCharsMap); GlyphTracerMessages messages; set<const Font*> tracedFonts; // collect unique fonts already traced - FORALL(usedChars, UsedCharsMap::const_iterator, it) { - const Font *font = it->first; + for (const auto &fontchar : usedCharsMap) { + const Font *font = fontchar.first; if (const PhysicalFont *ph_font = dynamic_cast<const PhysicalFont*>(font)) { // Check if glyphs should be traced. Only trace the glyphs of unique fonts, i.e. // avoid retracing the same glyphs again if they are referenced in various sizes. @@ -298,7 +304,7 @@ void DVIToSVG::embedFonts (XMLElementNode *svgElement) { tracedFonts.insert(ph_font->uniqueFont()); } if (font->path()) // does font file exist? - _svg.append(*ph_font, it->second, &messages); + _svg.append(*ph_font, fontchar.second, &messages); else Message::wstream(true) << "can't embed font '" << font->name() << "'\n"; } @@ -367,10 +373,10 @@ string DVIToSVG::getSVGFilename (unsigned pageno) const { void DVIToSVG::moveRight (double dx) { DVIReader::moveRight(dx); if (_actions) { - if (currState().d == WMODE_LR) - _actions->moveToX(currState().h+_tx); + if (dviState().d == WritingMode::LR) + _actions->moveToX(dviState().h+_tx); else - _actions->moveToY(currState().v+_ty); + _actions->moveToY(dviState().v+_ty); } } @@ -378,21 +384,21 @@ void DVIToSVG::moveRight (double dx) { void DVIToSVG::moveDown (double dy) { DVIReader::moveDown(dy); if (_actions) { - if (currState().d == WMODE_LR) - _actions->moveToY(currState().v+_ty); + if (dviState().d == WritingMode::LR) + _actions->moveToY(dviState().v+_ty); else - _actions->moveToX(currState().h+_tx); + _actions->moveToX(dviState().h+_tx); } } -void DVIToSVG::dviPost (UInt16, UInt16 pages, UInt32 pw, UInt32 ph, UInt32, UInt32, UInt32, UInt32) { +void DVIToSVG::dviPost (uint16_t, uint16_t pages, uint32_t pw, uint32_t ph, uint32_t, uint32_t, uint32_t, uint32_t) { _pageHeight = ph; // height of tallest page in dvi units _pageWidth = pw; // width of widest page in dvi units } -void DVIToSVG::dviBop (const std::vector<Int32> &c, Int32) { +void DVIToSVG::dviBop (const std::vector<int32_t> &c, int32_t) { _pageByte = 0; enterBeginPage(currentPageNumber(), c); if (_actions) { @@ -412,25 +418,25 @@ void DVIToSVG::dviEop () { } -void DVIToSVG::dviSetChar0 (UInt32 c, const Font *font) { +void DVIToSVG::dviSetChar0 (uint32_t c, const Font *font) { if (_actions && !dynamic_cast<const VirtualFont*>(font)) - _actions->setChar(prevState().h+_tx, prevState().v+_ty, c, prevState().d != WMODE_LR, *font); + _actions->setChar(dviState().h+_tx, dviState().v+_ty, c, dviState().d != WritingMode::LR, *font); } -void DVIToSVG::dviSetChar (UInt32 c, const Font *font) { +void DVIToSVG::dviSetChar (uint32_t c, const Font *font) { dviSetChar0(c, font); } -void DVIToSVG::dviPutChar (UInt32 c, const Font *font) { +void DVIToSVG::dviPutChar (uint32_t c, const Font *font) { dviSetChar0(c, font); } void DVIToSVG::dviSetRule (double height, double width) { if (_actions && height > 0 && width > 0) - _actions->setRule(currState().h+_tx, currState().v+_ty, height, width); + _actions->setRule(dviState().h+_tx, dviState().v+_ty, height, width); } @@ -441,17 +447,17 @@ void DVIToSVG::dviPutRule (double height, double width) { void DVIToSVG::dviPop () { if (_actions) { - if (prevState().h != currState().h) - _actions->moveToX(currState().h + _tx); - if (prevState().v != currState().v) - _actions->moveToY(currState().v + _ty); - if (prevState().d != currState().d) - _actions->setTextOrientation(currState().d != WMODE_LR); + if (_prevXPos != dviState().h+_tx) + _actions->moveToX(dviState().h + _tx); + if (_prevYPos != dviState().v+_ty) + _actions->moveToY(dviState().v + _ty); + if (_prevWritingMode != dviState().d) + _actions->setTextOrientation(dviState().d != WritingMode::LR); } } -void DVIToSVG::dviFontNum (UInt32 fontnum, SetFontMode, const Font *font) { +void DVIToSVG::dviFontNum (uint32_t fontnum, SetFontMode, const Font *font) { if (_actions && font && !dynamic_cast<const VirtualFont*>(font)) _actions->setFont(FontManager::instance().fontID(fontnum), *font); // all fonts get a recomputed ID } @@ -459,7 +465,7 @@ void DVIToSVG::dviFontNum (UInt32 fontnum, SetFontMode, const Font *font) { void DVIToSVG::dviDir (WritingMode dir) { if (_actions) - _actions->setTextOrientation(dir != WMODE_LR); + _actions->setTextOrientation(dir != WritingMode::LR); } @@ -469,24 +475,22 @@ void DVIToSVG::dviXXX (const std::string &str) { } -void DVIToSVG::dviXGlyphArray (std::vector<double> &dx, vector<double> &dy, vector<UInt16> &glyphs, const Font &font) { +void DVIToSVG::dviXGlyphArray (std::vector<double> &dx, vector<double> &dy, vector<uint16_t> &glyphs, const Font &font) { if (_actions) { for (size_t i=0; i < glyphs.size(); i++) - _actions->setChar(prevState().h+dx[i]+_tx, prevState().v+dy[i]+_ty, glyphs[i], false, font); + _actions->setChar(dviState().h+dx[i]+_tx, dviState().v+dy[i]+_ty, glyphs[i], false, font); } } -void DVIToSVG::dviXGlyphString (vector<double> &dx, vector<UInt16> &glyphs, const Font &font) { +void DVIToSVG::dviXGlyphString (vector<double> &dx, vector<uint16_t> &glyphs, const Font &font) { if (_actions) { for (size_t i=0; i < glyphs.size(); i++) - _actions->setChar(prevState().h+dx[i]+_tx, prevState().v+_ty, glyphs[i], false, font); + _actions->setChar(dviState().h+dx[i]+_tx, dviState().v+_ty, glyphs[i], false, font); } } -void DVIToSVG::dviXTextAndGlyphs (vector<double> &dx, vector<double> &dy, vector<UInt16>&, vector<UInt16> &glyphs, const Font &font) { +void DVIToSVG::dviXTextAndGlyphs (vector<double> &dx, vector<double> &dy, vector<uint16_t>&, vector<uint16_t> &glyphs, const Font &font) { dviXGlyphArray(dx, dy, glyphs, font); } - - diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.hpp index 623056ae0ea..6e1aafd699e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** DVIToSVG.h ** +** DVIToSVG.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,13 +18,13 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_DVITOSVG_H -#define DVISVGM_DVITOSVG_H +#ifndef DVITOSVG_HPP +#define DVITOSVG_HPP #include <string> #include <utility> -#include "DVIReader.h" -#include "SVGTree.h" +#include "DVIReader.hpp" +#include "SVGTree.hpp" struct DVIActions; class Matrix; @@ -38,12 +38,12 @@ class DVIToSVG : public DVIReader void convert (const std::string &range, std::pair<int,int> *pageinfo=0); void setPageSize (const std::string &format) {_bboxFormatString = format;} void setPageTransformation (const std::string &cmds) {_transCmds = cmds;} - void getPageTransformation (Matrix &matrix) const; - void translateToX (double x) {_tx = x-currState().h-_tx;} - void translateToY (double y) {_ty = y-currState().v-_ty;} - double getXPos() const {return currState().h+_tx;} - double getYPos() const {return currState().v+_ty;} - void finishLine () {_prevYPos = std::numeric_limits<double>::min();} + void getPageTransformation (Matrix &matrix) const override; + void translateToX (double x) override {_tx = x-dviState().h-_tx;} + void translateToY (double y) override {_ty = y-dviState().v-_ty;} + double getXPos() const override {return dviState().h+_tx;} + double getYPos() const override {return dviState().v+_ty;} + void finishLine () override {_prevYPos = std::numeric_limits<double>::min();} std::string getSVGFilename (unsigned pageno) const; std::string getUserBBoxString () const {return _bboxFormatString;} @@ -56,28 +56,28 @@ class DVIToSVG : public DVIReader protected: DVIToSVG (const DVIToSVG&); void convert (unsigned firstPage, unsigned lastPage, std::pair<int,int> *pageinfo=0); - int executeCommand (); - void enterBeginPage (unsigned pageno, const std::vector<Int32> &c); + int executeCommand () override; + void enterBeginPage (unsigned pageno, const std::vector<int32_t> &c); void leaveEndPage (unsigned pageno); void embedFonts (XMLElementNode *svgElement); - void moveRight (double dx); - void moveDown (double dy); + void moveRight (double dx) override; + void moveDown (double dy) override; - void dviPost (UInt16 stdepth, UInt16 pages, UInt32 pw, UInt32 ph, UInt32 mag, UInt32 num, UInt32 den, UInt32 lbopofs); - void dviBop (const std::vector<Int32> &c, Int32 prevBopOffset); - void dviEop (); - void dviSetChar0 (UInt32 c, const Font *font); - void dviSetChar (UInt32 c, const Font *font); - void dviPutChar (UInt32 c, const Font *font); - void dviSetRule (double h, double w); - void dviPutRule (double h, double w); - void dviPop (); - void dviFontNum (UInt32 fontnum, SetFontMode mode, const Font *font); - void dviDir (WritingMode dir); - void dviXXX (const std::string &str); - void dviXGlyphArray (std::vector<double> &dx, std::vector<double> &dy, std::vector<UInt16> &glyphs, const Font &font); - void dviXGlyphString (std::vector<double> &dx, std::vector<UInt16> &glyphs, const Font &font); - void dviXTextAndGlyphs (std::vector<double> &dx, std::vector<double> &dy, std::vector<UInt16> &chars, std::vector<UInt16> &glyphs, const Font &font); + void dviPost (uint16_t stdepth, uint16_t pages, uint32_t pw, uint32_t ph, uint32_t mag, uint32_t num, uint32_t den, uint32_t lbopofs) override; + void dviBop (const std::vector<int32_t> &c, int32_t prevBopOffset) override; + void dviEop () override; + void dviSetChar0 (uint32_t c, const Font *font) override; + void dviSetChar (uint32_t c, const Font *font) override; + void dviPutChar (uint32_t c, const Font *font) override; + void dviSetRule (double h, double w) override; + void dviPutRule (double h, double w) override; + void dviPop () override; + void dviFontNum (uint32_t fontnum, SetFontMode mode, const Font *font) override; + void dviDir (WritingMode dir) override; + void dviXXX (const std::string &str) override; + void dviXGlyphArray (std::vector<double> &dx, std::vector<double> &dy, std::vector<uint16_t> &glyphs, const Font &font) override; + void dviXGlyphString (std::vector<double> &dx, std::vector<uint16_t> &glyphs, const Font &font) override; + void dviXTextAndGlyphs (std::vector<double> &dx, std::vector<double> &dy, std::vector<uint16_t> &chars, std::vector<uint16_t> &glyphs, const Font &font) override; private: SVGTree _svg; @@ -87,7 +87,8 @@ class DVIToSVG : public DVIReader std::string _transCmds; ///< page transformation commands set by the user double _pageHeight, _pageWidth; ///< global page height and width stored in the postamble double _tx, _ty; ///< translation of cursor position - double _prevYPos; ///< previous vertical cursor position + double _prevXPos, _prevYPos; ///< previous cursor position + WritingMode _prevWritingMode; ///< previous writing mode std::streampos _pageByte; ///< position of the stream pointer relative to the preceding bop (in bytes) }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp index 2b774ca80d0..c1f35ef0115 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp @@ -2,7 +2,7 @@ ** DVIToSVGActions.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,34 +18,28 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#include <config.h> #include <cstring> #include <ctime> -#include "BoundingBox.h" -#include "DVIToSVG.h" -#include "DVIToSVGActions.h" -#include "Font.h" -#include "FontManager.h" -#include "GlyphTracerMessages.h" -#include "System.h" - +#include "BoundingBox.hpp" +#include "DVIToSVG.hpp" +#include "DVIToSVGActions.hpp" +#include "Font.hpp" +#include "FontManager.hpp" +#include "GlyphTracerMessages.hpp" +#include "System.hpp" +#include "utility.hpp" using namespace std; DVIToSVGActions::DVIToSVGActions (DVIToSVG &dvisvg, SVGTree &svg) - : _svg(svg), _dvireader(&dvisvg), _bgcolor(Color::TRANSPARENT), _boxes(0) + : _svg(svg), _dvireader(&dvisvg), _bgcolor(Color::TRANSPARENT) { _currentFontNum = -1; _pageCount = 0; } -DVIToSVGActions::~DVIToSVGActions () { - delete _boxes; -} - - void DVIToSVGActions::reset() { _usedChars.clear(); _usedFonts.clear(); @@ -215,12 +209,11 @@ void DVIToSVGActions::special (const string &spc, double dvi2bp, bool preprocess * @param[in] pageno physical page number * @param[in] c array with 10 components representing \\count0 ... \\count9. c[0] contains the * current (printed) page number (may differ from page count) */ -void DVIToSVGActions::beginPage (unsigned pageno, const vector<Int32>&) { +void DVIToSVGActions::beginPage (unsigned pageno, const vector<int32_t>&) { SpecialManager::instance().notifyBeginPage(pageno, *this); _svg.newPage(++_pageCount); _bbox = BoundingBox(); // clear bounding box - if (_boxes) - _boxes->clear(); + _boxes.clear(); } @@ -248,12 +241,10 @@ void DVIToSVGActions::setBgColor (const Color &color) { } -void DVIToSVGActions::embed(const BoundingBox& bbox) { +void DVIToSVGActions::embed(const BoundingBox &bbox) { _bbox.embed(bbox); - if (_boxes) { - FORALL(*_boxes, BoxMap::iterator, it) - it->second.embed(bbox); - } + for (auto &strboxpair : _boxes) + strboxpair.second.embed(bbox); } @@ -262,16 +253,13 @@ void DVIToSVGActions::embed(const DPair& p, double r) { _bbox.embed(p); else _bbox.embed(p, r); - if (_boxes) - FORALL(*_boxes, BoxMap::iterator, it) - it->second.embed(p, r); + for (auto &strboxpair : _boxes) + strboxpair.second.embed(p, r); } BoundingBox& DVIToSVGActions::bbox(const string& name, bool reset) { - if (!_boxes) - _boxes = new BoxMap; - BoundingBox &box = (*_boxes)[name]; + BoundingBox &box = _boxes[name]; if (reset) box = BoundingBox(); return box; @@ -299,8 +287,8 @@ static int digits (int n) { if (n == 0) return 1; if (n > 0) - return int(log10(double(n))+1); - return int(log10(double(-n))+2); + return util::ilog10(n)+1; + return util::ilog10(-n)+2; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.h deleted file mode 100644 index fb2ca03f29b..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.h +++ /dev/null @@ -1,101 +0,0 @@ -/************************************************************************* -** DVIToSVGActions.h ** -** ** -** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** published by the Free Software Foundation; either version 3 of ** -** the License, or (at your option) any later version. ** -** ** -** This program is distributed in the hope that it will be useful, but ** -** WITHOUT ANY WARRANTY; without even the implied warranty of ** -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** -** GNU General Public License for more details. ** -** ** -** You should have received a copy of the GNU General Public License ** -** along with this program; if not, see <http://www.gnu.org/licenses/>. ** -*************************************************************************/ - -#ifndef DVISVGM_DVITOSVGACTIONS_H -#define DVISVGM_DVITOSVGACTIONS_H - -#include <map> -#include <set> -#include "BoundingBox.h" -#include "DVIActions.h" -#include "Matrix.h" -#include "SpecialActions.h" -#include "SpecialManager.h" -#include "SVGTree.h" - - -class DVIToSVG; -struct FileFinder; -class Font; -class XMLNode; - -class DVIToSVGActions : public DVIActions, public SpecialActions -{ - typedef std::map<const Font*, std::set<int> > CharMap; - typedef std::set<const Font*> FontSet; - typedef std::map<std::string,BoundingBox> BoxMap; - - public: - DVIToSVGActions (DVIToSVG &dvisvg, SVGTree &svg); - ~DVIToSVGActions (); - void reset (); - void setChar (double x, double y, unsigned c, bool vertical, const Font &f); - void setRule (double x, double y, double height, double width); - void setBgColor (const Color &color); - void setColor (const Color &color) {_svg.setColor(color);} - void setMatrix (const Matrix &m) {_svg.setMatrix(m);} - const Matrix& getMatrix () const {return _svg.getMatrix();} - void getPageTransform (Matrix &matrix) const {_dvireader->getPageTransformation(matrix);} - Color getColor () const {return _svg.getColor();} - int getDVIStackDepth() const {return _dvireader->stackDepth();} - unsigned getCurrentPageNumber() const {return _dvireader->currentPageNumber();} - void appendToPage (XMLNode *node) {_svg.appendToPage(node);} - void appendToDefs (XMLNode *node) {_svg.appendToDefs(node);} - void prependToPage (XMLNode *node) {_svg.prependToPage(node);} - void pushContextElement (XMLElementNode *node) {_svg.pushContextElement(node);} - void popContextElement () {_svg.popContextElement();} - void setTextOrientation(bool vertical) {_svg.setVertical(vertical);} - void moveToX (double x); - void moveToY (double y); - void setFont (int num, const Font &font); - void special (const std::string &spc, double dvi2bp, bool preprocessing=false); - void beginPage (unsigned pageno, const std::vector<Int32> &c); - void endPage (unsigned pageno); - void progress (size_t current, size_t total, const char *id=0); - void progress (const char *id); - CharMap& getUsedChars () const {return _usedChars;} - const FontSet& getUsedFonts () const {return _usedFonts;} - void setDVIReader (BasicDVIReader &r) {_dvireader = &r;} - double getX() const {return _dvireader->getXPos();} - double getY() const {return _dvireader->getYPos();} - void setX (double x) {_dvireader->translateToX(x); _svg.setX(x);} - void setY (double y) {_dvireader->translateToY(y); _svg.setY(y);} - void finishLine () {_dvireader->finishLine();} - BoundingBox& bbox () {return _bbox;} - BoundingBox& bbox (const std::string &name, bool reset=false); - void embed (const BoundingBox &bbox); - void embed (const DPair &p, double r=0); - std::string getSVGFilename (unsigned pageno) const; - std::string getBBoxFormatString () const; - - private: - SVGTree &_svg; - BasicDVIReader *_dvireader; - BoundingBox _bbox; - int _pageCount; - int _currentFontNum; - mutable CharMap _usedChars; - FontSet _usedFonts; - Color _bgcolor; - BoxMap *_boxes; -}; - - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.hpp new file mode 100644 index 00000000000..613315346e1 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.hpp @@ -0,0 +1,100 @@ +/************************************************************************* +** DVIToSVGActions.hpp ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef DVITOSVGACTIONS_HPP +#define DVITOSVGACTIONS_HPP + +#include <map> +#include <set> +#include "BoundingBox.hpp" +#include "DVIActions.hpp" +#include "Matrix.hpp" +#include "SpecialActions.hpp" +#include "SpecialManager.hpp" +#include "SVGTree.hpp" + + +class DVIToSVG; +class FileFinder; +class Font; +class XMLNode; + +class DVIToSVGActions : public DVIActions, public SpecialActions +{ + typedef std::map<const Font*, std::set<int>> CharMap; + typedef std::set<const Font*> FontSet; + typedef std::map<std::string,BoundingBox> BoxMap; + + public: + DVIToSVGActions (DVIToSVG &dvisvg, SVGTree &svg); + void reset (); + void setChar (double x, double y, unsigned c, bool vertical, const Font &f) override; + void setRule (double x, double y, double height, double width) override; + void setBgColor (const Color &color) override; + void setColor (const Color &color) override {_svg.setColor(color);} + void setMatrix (const Matrix &m) override {_svg.setMatrix(m);} + const Matrix& getMatrix () const override {return _svg.getMatrix();} + void getPageTransform (Matrix &matrix) const override {_dvireader->getPageTransformation(matrix);} + Color getColor () const override {return _svg.getColor();} + int getDVIStackDepth() const override {return _dvireader->stackDepth();} + unsigned getCurrentPageNumber() const override {return _dvireader->currentPageNumber();} + void appendToPage (XMLNode *node) override {_svg.appendToPage(node);} + void appendToDefs (XMLNode *node) override {_svg.appendToDefs(node);} + void prependToPage (XMLNode *node) override {_svg.prependToPage(node);} + void pushContextElement (XMLElementNode *node) override {_svg.pushContextElement(node);} + void popContextElement () override {_svg.popContextElement();} + void setTextOrientation(bool vertical) override {_svg.setVertical(vertical);} + void moveToX (double x) override; + void moveToY (double y) override; + void setFont (int num, const Font &font) override; + void special (const std::string &spc, double dvi2bp, bool preprocessing=false) override; + void beginPage (unsigned pageno, const std::vector<int32_t> &c) override; + void endPage (unsigned pageno) override; + void progress (size_t current, size_t total, const char *id=0) override; + void progress (const char *id) override; + double getX() const override {return _dvireader->getXPos();} + double getY() const override {return _dvireader->getYPos();} + void setX (double x) override {_dvireader->translateToX(x); _svg.setX(x);} + void setY (double y) override {_dvireader->translateToY(y); _svg.setY(y);} + void finishLine () override {_dvireader->finishLine();} + BoundingBox& bbox () override {return _bbox;} + BoundingBox& bbox (const std::string &name, bool reset=false) override; + void embed (const BoundingBox &bbox) override; + void embed (const DPair &p, double r=0) override; + std::string getSVGFilename (unsigned pageno) const override; + std::string getBBoxFormatString () const override; + CharMap& getUsedChars () const {return _usedChars;} + const FontSet& getUsedFonts () const {return _usedFonts;} + void setDVIReader (BasicDVIReader &r) {_dvireader = &r;} + + private: + SVGTree &_svg; + BasicDVIReader *_dvireader; + BoundingBox _bbox; + int _pageCount; + int _currentFontNum; + mutable CharMap _usedChars; + FontSet _usedFonts; + Color _bgcolor; + BoxMap _boxes; +}; + + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DependencyGraph.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/DependencyGraph.hpp index b2d35a7152e..52dd46ac17b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DependencyGraph.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DependencyGraph.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** DependencyGraph.h ** +** DependencyGraph.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,9 +18,8 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ - -#ifndef DEPENDENCYGRAPH_H -#define DEPENDENCYGRAPH_H +#ifndef DEPENDENCYGRAPH_HPP +#define DEPENDENCYGRAPH_HPP #include <map> #include <vector> @@ -30,7 +29,6 @@ class DependencyGraph { struct GraphNode { typedef typename std::vector<GraphNode*> Dependees; - typedef typename Dependees::iterator Iterator; GraphNode (const T &k) : key(k), dependent(0) {} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.cpp index 6bb48bb343f..9dbfd0877fc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.cpp @@ -2,7 +2,7 @@ ** Directory.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,7 +19,7 @@ *************************************************************************/ #include <config.h> -#include "Directory.h" +#include "Directory.hpp" using namespace std; @@ -33,9 +33,9 @@ using namespace std; Directory::Directory () { #if _WIN32 - handle = INVALID_HANDLE_VALUE; - firstread = true; - memset(&fileData, 0, sizeof(WIN32_FIND_DATA)); + _handle = INVALID_HANDLE_VALUE; + _firstread = true; + memset(&_fileData, 0, sizeof(WIN32_FIND_DATA)); #else _dir = 0; _dirent = 0; @@ -43,11 +43,11 @@ Directory::Directory () { } -Directory::Directory (string dirname) { +Directory::Directory (const string &dirname) { #if _WIN32 - handle = INVALID_HANDLE_VALUE; - firstread = true; - memset(&fileData, 0, sizeof(WIN32_FIND_DATA)); + _handle = INVALID_HANDLE_VALUE; + _firstread = true; + memset(&_fileData, 0, sizeof(WIN32_FIND_DATA)); #else _dir = 0; _dirent = 0; @@ -61,15 +61,15 @@ Directory::~Directory () { } -bool Directory::open (string dname) { - _dirname = dname; +bool Directory::open (string dirname) { + _dirname = dirname; #ifdef _WIN32 - firstread = true; - if (dname[dname.length()-1] == '/' || dname[dname.length()-1] == '\\') - dname = dname.substr(0, dname.length()-1); - dname += "\\*"; - handle = FindFirstFile(dname.c_str(), &fileData); - return handle != INVALID_HANDLE_VALUE; + _firstread = true; + if (dirname[dirname.length()-1] == '/' || dirname[dirname.length()-1] == '\\') + dirname = dirname.substr(0, dirname.length()-1); + dirname += "\\*"; + _handle = FindFirstFile(dirname.c_str(), &_fileData); + return _handle != INVALID_HANDLE_VALUE; #else _dir = opendir(_dirname.c_str()); return bool(_dir); @@ -79,7 +79,7 @@ bool Directory::open (string dname) { void Directory::close () { #ifdef _WIN32 - FindClose(handle); + FindClose(_handle); #else closedir(_dir); #endif @@ -91,19 +91,19 @@ void Directory::close () { * @return name of entry */ const char* Directory::read (EntryType type) { #ifdef _WIN32 - if (handle == INVALID_HANDLE_VALUE) + if (_handle == INVALID_HANDLE_VALUE) return 0; - while (firstread || FindNextFile(handle, &fileData)) { - firstread = false; - if (fileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + while (_firstread || FindNextFile(_handle, &_fileData)) { + _firstread = false; + if (_fileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (type == ET_FILE_OR_DIR || type == ET_DIR) - return fileData.cFileName; + return _fileData.cFileName; } else if (type == ET_FILE_OR_DIR || type == ET_FILE) - return fileData.cFileName; + return _fileData.cFileName; } - FindClose(handle); - handle = INVALID_HANDLE_VALUE; + FindClose(_handle); + _handle = INVALID_HANDLE_VALUE; return 0; #else if (!_dir) diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.hpp index 0356e4951b4..fa0e2543abb 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** Directory.h ** +** Directory.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,8 +18,8 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_DIRECTORY_H -#define DVISVGM_DIRECTORY_H +#ifndef DIRECTORY_HPP +#define DIRECTORY_HPP #include <string> #ifdef _WIN32 @@ -35,7 +35,7 @@ class Directory public: Directory (); - Directory (std::string path); + Directory (const std::string &path); ~Directory (); bool open (std::string path); void close (); @@ -44,9 +44,9 @@ class Directory private: std::string _dirname; #ifdef _WIN32 - bool firstread; - HANDLE handle; - WIN32_FIND_DATA fileData; + bool _firstread; + HANDLE _handle; + WIN32_FIND_DATA _fileData; #else DIR *_dir; struct dirent *_dirent; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.cpp index 34efddfac4e..ad09f800d7e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.cpp @@ -2,7 +2,7 @@ ** DvisvgmSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -21,13 +21,13 @@ #include <config.h> #include <cstring> #include <utility> -#include "DvisvgmSpecialHandler.h" -#include "InputBuffer.h" -#include "InputReader.h" -#include "Length.h" -#include "SpecialActions.h" -#include "XMLNode.h" -#include "XMLString.h" +#include "DvisvgmSpecialHandler.hpp" +#include "InputBuffer.hpp" +#include "InputReader.hpp" +#include "Length.hpp" +#include "SpecialActions.hpp" +#include "XMLNode.hpp" +#include "XMLString.hpp" using namespace std; @@ -76,7 +76,7 @@ void DvisvgmSpecialHandler::preprocessRawSet (InputReader &ir) { throw SpecialException("redefinition of SVG fragment '" + id + "'"); } pair<string, StringVector> entry(id, StringVector()); - pair<MacroMap::iterator, bool> state = _macros.insert(entry); + pair<MacroMap::iterator, bool> state = _macros.emplace(move(entry)); _currentMacro = state.first; } @@ -92,7 +92,7 @@ void DvisvgmSpecialHandler::preprocessRaw (InputReader &ir) { return; string str = ir.getLine(); if (!str.empty()) - _currentMacro->second.push_back(string("P")+str); + _currentMacro->second.emplace_back(string("P")+str); } @@ -101,7 +101,7 @@ void DvisvgmSpecialHandler::preprocessRawDef (InputReader &ir) { return; string str = ir.getLine(); if (!str.empty()) - _currentMacro->second.push_back(string("D")+str); + _currentMacro->second.emplace_back(string("D")+str); } @@ -225,10 +225,10 @@ void DvisvgmSpecialHandler::processRawPut (InputReader &ir, SpecialActions &acti if (it == _macros.end()) throw SpecialException("undefined SVG fragment '" + id + "' referenced"); - StringVector &defs = it->second; - for (StringVector::iterator defs_it=defs.begin(); defs_it != defs.end(); ++defs_it) { - char &type = defs_it->at(0); - string def = defs_it->substr(1); + StringVector &defvector = it->second; + for (string &defstr : defvector) { + char &type = defstr[0]; + string def = defstr.substr(1); if ((type == 'P' || type == 'D') && !def.empty()) { expand_constants(def, actions); if (type == 'P') @@ -331,12 +331,12 @@ void DvisvgmSpecialHandler::dviPreprocessingFinished () { void DvisvgmSpecialHandler::dviEndPage (unsigned, SpecialActions&) { - for (MacroMap::iterator map_it=_macros.begin(); map_it != _macros.end(); ++map_it) { - StringVector &vec = map_it->second; - for (StringVector::iterator str_it=vec.begin(); str_it != vec.end(); ++str_it) { + for (auto &strvecpair : _macros) { + StringVector &vec = strvecpair.second; + for (string &str : vec) { // activate locked parts of a pattern again - if (str_it->at(0) == 'L') - str_it->at(0) = 'D'; + if (str[0] == 'L') + str[0] = 'D'; } } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.hpp index d02f6057eb7..5282f546bc1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** DvisvgmSpecialHandler.h ** +** DvisvgmSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,13 +18,13 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_DVISVGMSPECIALHANDLER_H -#define DVISVGM_DVISVGMSPECIALHANDLER_H +#ifndef DVISVGMSPECIALHANDLER_HPP +#define DVISVGMSPECIALHANDLER_HPP #include <map> #include <string> #include <vector> -#include "SpecialHandler.h" +#include "SpecialHandler.hpp" class InputReader; class SpecialActions; @@ -36,11 +36,11 @@ class DvisvgmSpecialHandler : public SpecialHandler, public DVIPreprocessingList public: DvisvgmSpecialHandler (); - const char* name () const {return "dvisvgm";} - const char* info () const {return "special set for embedding raw SVG snippets";} - const char** prefixes () const; - void preprocess (const char *prefix, std::istream &is, SpecialActions &actions); - bool process (const char *prefix, std::istream &is, SpecialActions &actions); + const char* name () const override {return "dvisvgm";} + const char* info () const override {return "special set for embedding raw SVG snippets";} + const char** prefixes () const override; + void preprocess (const char *prefix, std::istream &is, SpecialActions &actions) override; + bool process (const char *prefix, std::istream &is, SpecialActions &actions) override; protected: void preprocessRaw (InputReader &ir); @@ -55,8 +55,8 @@ class DvisvgmSpecialHandler : public SpecialHandler, public DVIPreprocessingList void processRawPut (InputReader &ir, SpecialActions &actions); void processBBox (InputReader &ir, SpecialActions &actions); void processImg (InputReader &ir, SpecialActions &actions); - void dviPreprocessingFinished (); - void dviEndPage (unsigned pageno, SpecialActions &actions); + void dviPreprocessingFinished () override; + void dviEndPage (unsigned pageno, SpecialActions &actions) override; private: MacroMap _macros; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.cpp index a4a9af21457..516590e84aa 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.cpp @@ -2,7 +2,7 @@ ** EPSFile.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -22,16 +22,16 @@ #include <cstring> #include <istream> #include <limits> -#include "EPSFile.h" -#include "InputBuffer.h" -#include "InputReader.h" +#include "EPSFile.hpp" +#include "InputBuffer.hpp" +#include "InputReader.hpp" using namespace std; /** Reads a little-endian 32-bit integer from the given input stream. */ -static UInt32 getUInt32 (istream &is) { - UInt32 value=0; +static uint32_t getUInt32 (istream &is) { + uint32_t value=0; char buf[4]; is.read(buf, 4); for (int i=0; i < 4; i++) diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.hpp index f330bde7a08..b4139090d13 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** EPSFile.h ** +** EPSFile.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,13 +18,12 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_EPSFILE_H -#define DVISVGM_EPSFILE_H +#ifndef EPSFILE_HPP +#define EPSFILE_HPP #include <fstream> #include <string> -#include "BoundingBox.h" -#include "types.h" +#include "BoundingBox.hpp" class EPSFile { @@ -33,14 +32,13 @@ class EPSFile std::istream& istream () const; bool hasValidHeader () const {return _headerValid;} bool bbox (BoundingBox &box) const; - UInt32 pslength () const {return _pslength;} + uint32_t pslength () const {return _pslength;} private: mutable std::ifstream _ifs; - bool _headerValid; ///< true if file has a valid header - UInt32 _offset; ///< stream offset where ASCII part of the file begins - UInt32 _pslength; ///< length of PS section (in bytes) + bool _headerValid; ///< true if file has a valid header + uint32_t _offset; ///< stream offset where ASCII part of the file begins + uint32_t _pslength; ///< length of PS section (in bytes) }; #endif - diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.cpp index 0fb638b6667..ec50c21c487 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.cpp @@ -2,7 +2,7 @@ ** EPSToSVG.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,17 +18,16 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#include <config.h> #include <fstream> #include <sstream> -#include "EPSFile.h" -#include "EPSToSVG.h" -#include "Message.h" -#include "MessageException.h" -#include "PsSpecialHandler.h" -#include "SVGOutput.h" -#include "System.h" - +#include "EPSFile.hpp" +#include "EPSToSVG.hpp" +#include "Message.hpp" +#include "MessageException.hpp" +#include "PsSpecialHandler.hpp" +#include "SVGOutput.hpp" +#include "System.hpp" +#include "version.hpp" using namespace std; @@ -67,16 +66,22 @@ void EPSToSVG::convert () { progress(0); // output SVG file _svg.setBBox(_bbox); - _svg.appendToDoc(new XMLCommentNode(" This file was generated by dvisvgm " VERSION " ")); - _svg.write(_out.getPageStream(1, 1)); + _svg.appendToDoc(new XMLCommentNode(" This file was generated by dvisvgm " + string(PROGRAM_VERSION) + " ")); + bool success = _svg.write(_out.getPageStream(1, 1)); string svgfname = _out.filename(1, 1); - const double bp2pt = 72.27/72; - const double bp2mm = 25.4/72; - Message::mstream(false, Message::MC_PAGE_SIZE) << "graphic size: " << XMLString(bbox.width()*bp2pt) << "pt" - " x " << XMLString(bbox.height()*bp2pt) << "pt" - " (" << XMLString(bbox.width()*bp2mm) << "mm" - " x " << XMLString(bbox.height()*bp2mm) << "mm)\n"; - Message::mstream(false, Message::MC_PAGE_WRITTEN) << "output written to " << (svgfname.empty() ? "<stdout>" : svgfname) << '\n'; + if (svgfname.empty()) + svgfname = "<stdout>"; + if (!success) + Message::wstream() << "failed to write output to " << svgfname << '\n'; + else { + const double bp2pt = 72.27/72; + const double bp2mm = 25.4/72; + Message::mstream(false, Message::MC_PAGE_SIZE) << "graphic size: " << XMLString(bbox.width()*bp2pt) << "pt" + " x " << XMLString(bbox.height()*bp2pt) << "pt" + " (" << XMLString(bbox.width()*bp2mm) << "mm" + " x " << XMLString(bbox.height()*bp2mm) << "mm)\n"; + Message::mstream(false, Message::MC_PAGE_WRITTEN) << "output written to " << svgfname << '\n'; + } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.h deleted file mode 100644 index 5d24edd2a56..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.h +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************* -** EPSToSVG.h ** -** ** -** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** published by the Free Software Foundation; either version 3 of ** -** the License, or (at your option) any later version. ** -** ** -** This program is distributed in the hope that it will be useful, but ** -** WITHOUT ANY WARRANTY; without even the implied warranty of ** -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** -** GNU General Public License for more details. ** -** ** -** You should have received a copy of the GNU General Public License ** -** along with this program; if not, see <http://www.gnu.org/licenses/>. ** -*************************************************************************/ - -#ifndef DVISVGM_EPSTOSVG_H -#define DVISVGM_EPSTOSVG_H - -#include <string> -#include "SpecialActions.h" -#include "SVGTree.h" - -struct SVGOutputBase; - -class EPSToSVG : protected SpecialActions -{ - public: - EPSToSVG (const std::string &fname, SVGOutputBase &out) : _fname(fname), _out(out), _x(0), _y(0) {} - void convert (); - void setTransformation (const Matrix &m); - void setPageSize (const std::string &name); - - protected: - // implement abstract base class SpecialActions - double getX () const {return _x;} - double getY () const {return _y;} - void setX (double x) {_x = x; _svg.setX(x);} - void setY (double y) {_y = y; _svg.setY(y);} - void finishLine () {} - void setColor (const Color &color) {_svg.setColor(color);} - Color getColor () const {return _svg.getColor();} - void setMatrix (const Matrix &m) {_svg.setMatrix(m);} - const Matrix& getMatrix () const {return _svg.getMatrix();} - void getPageTransform (Matrix &matrix) const {} - void setBgColor (const Color &color) {} - void appendToPage (XMLNode *node) {_svg.appendToPage(node);} - void appendToDefs (XMLNode *node) {_svg.appendToDefs(node);} - void prependToPage (XMLNode *node) {_svg.prependToPage(node);} - void pushContextElement (XMLElementNode *node) {_svg.pushContextElement(node);} - void popContextElement () {_svg.popContextElement();} - void embed (const BoundingBox &bbox) {_bbox.embed(bbox);} - void embed (const DPair &p, double r=0) {if (r==0) _bbox.embed(p); else _bbox.embed(p, r);} - void progress (const char *id); - unsigned getCurrentPageNumber() const {return 0;} - BoundingBox& bbox () {return _bbox;} - BoundingBox& bbox (const std::string &name, bool reset=false) {return _bbox;} - std::string getSVGFilename (unsigned pageno) const; - std::string getBBoxFormatString () const {return "";} - - private: - std::string _fname; ///< name of EPS file - SVGTree _svg; - SVGOutputBase &_out; - double _x, _y; - BoundingBox _bbox; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.hpp new file mode 100644 index 00000000000..5d3172d2911 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.hpp @@ -0,0 +1,73 @@ +/************************************************************************* +** EPSToSVG.hpp ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef EPSTOSVG_HPP +#define EPSTOSVG_HPP + +#include <string> +#include "SpecialActions.hpp" +#include "SVGTree.hpp" + +struct SVGOutputBase; + +class EPSToSVG : protected SpecialActions +{ + public: + EPSToSVG (const std::string &fname, SVGOutputBase &out) : _fname(fname), _out(out), _x(0), _y(0) {} + void convert (); + void setTransformation (const Matrix &m); + void setPageSize (const std::string &name); + + protected: + // implement abstract base class SpecialActions + double getX () const override {return _x;} + double getY () const override {return _y;} + void setX (double x) override {_x = x; _svg.setX(x);} + void setY (double y) override {_y = y; _svg.setY(y);} + void finishLine () override {} + void setColor (const Color &color) override {_svg.setColor(color);} + Color getColor () const override {return _svg.getColor();} + void setMatrix (const Matrix &m) override {_svg.setMatrix(m);} + const Matrix& getMatrix () const override {return _svg.getMatrix();} + void getPageTransform (Matrix &matrix) const override {} + void setBgColor (const Color &color) override {} + void appendToPage (XMLNode *node) override {_svg.appendToPage(node);} + void appendToDefs (XMLNode *node) override {_svg.appendToDefs(node);} + void prependToPage (XMLNode *node) override {_svg.prependToPage(node);} + void pushContextElement (XMLElementNode *node) override {_svg.pushContextElement(node);} + void popContextElement () override {_svg.popContextElement();} + void embed (const BoundingBox &bbox) override {_bbox.embed(bbox);} + void embed (const DPair &p, double r=0) override {if (r==0) _bbox.embed(p); else _bbox.embed(p, r);} + void progress (const char *id) override; + unsigned getCurrentPageNumber() const override {return 0;} + BoundingBox& bbox () override {return _bbox;} + BoundingBox& bbox (const std::string &name, bool reset=false) override {return _bbox;} + std::string getSVGFilename (unsigned pageno) const override; + std::string getBBoxFormatString () const override {return "";} + + private: + std::string _fname; ///< name of EPS file + SVGTree _svg; + SVGOutputBase &_out; + double _x, _y; + BoundingBox _bbox; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.cpp index bdd4b12670a..d7fc27bce98 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.cpp @@ -2,7 +2,7 @@ ** EmSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -20,13 +20,13 @@ #include <config.h> #include <sstream> -#include "EmSpecialHandler.h" -#include "InputBuffer.h" -#include "InputReader.h" -#include "Length.h" -#include "SpecialActions.h" -#include "XMLNode.h" -#include "XMLString.h" +#include "EmSpecialHandler.hpp" +#include "InputBuffer.hpp" +#include "InputReader.hpp" +#include "Length.hpp" +#include "SpecialActions.hpp" +#include "XMLNode.hpp" +#include "XMLString.hpp" using namespace std; @@ -129,7 +129,7 @@ static double read_length (InputReader &in) { string unitstr; if (isalpha(in.peek())) unitstr += in.get(); if (isalpha(in.peek())) unitstr += in.get(); - Length::Unit unit = Length::PT; + Length::Unit unit = Length::Unit::PT; try { unit = Length::stringToUnit(unitstr); } @@ -238,7 +238,7 @@ void EmSpecialHandler::line (InputReader &ir, SpecialActions& actions) { // Line endpoints don't necessarily have to be defined before // a line definition. If a point isn't defined yet, we put the line // in a wait list and process the lines at the end of the page. - _lines.push_back(Line(pointnum1, pointnum2, char(cut1), char(cut2), linewidth)); + _lines.emplace_back(Line(pointnum1, pointnum2, char(cut1), char(cut2), linewidth)); } } @@ -246,11 +246,11 @@ void EmSpecialHandler::line (InputReader &ir, SpecialActions& actions) { /** This method is called at the end of a DVI page. Here we have to draw all pending * lines that are still in the line list. All line endpoints must be defined until here. */ void EmSpecialHandler::dviEndPage (unsigned pageno, SpecialActions &actions) { - FORALL(_lines, list<Line>::iterator, it) { - map<int,DPair>::iterator pit1=_points.find(it->p1); - map<int,DPair>::iterator pit2=_points.find(it->p2); + for (const Line &line : _lines) { + auto pit1=_points.find(line.p1); + auto pit2=_points.find(line.p2); if (pit1 != _points.end() && pit2 != _points.end()) - create_line(pit1->second, pit2->second, it->c1, it->c2, it->width, actions); + create_line(pit1->second, pit2->second, line.c1, line.c2, line.width, actions); // all lines with still undefined points are ignored } // line and point definitions are local to a page diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.hpp index 689ea5a39b8..c9febab3425 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** EmSpecialHandler.h ** +** EmSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,13 +18,13 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_EMSPECIALHANDLER_H -#define DVISVGM_EMSPECIALHANDLER_H +#ifndef EMSPECIALHANDLER_HPP +#define EMSPECIALHANDLER_HPP #include <list> #include <map> -#include "Pair.h" -#include "SpecialHandler.h" +#include "Pair.hpp" +#include "SpecialHandler.hpp" class InputReader; class SpecialActions; @@ -40,13 +40,13 @@ class EmSpecialHandler : public SpecialHandler, public DVIEndPageListener public: EmSpecialHandler (); - const char* name () const {return "em";} - const char* info () const {return "line drawing statements of the emTeX special set";} - const char** prefixes () const; - bool process (const char *prefix, std::istream &in, SpecialActions &actions); + const char* name () const override {return "em";} + const char* info () const override {return "line drawing statements of the emTeX special set";} + const char** prefixes () const override; + bool process (const char *prefix, std::istream &in, SpecialActions &actions) override; protected: - void dviEndPage (unsigned pageno, SpecialActions &actions); + void dviEndPage (unsigned pageno, SpecialActions &actions) override; void linewidth (InputReader &ir, SpecialActions &actions); void moveto (InputReader &ir, SpecialActions &actions); void lineto (InputReader &ir, SpecialActions &actions); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.cpp index 705230a016c..2dc2ab8e7d2 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.cpp @@ -2,7 +2,7 @@ ** EncFile.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -20,12 +20,12 @@ #include <config.h> #include <fstream> -#include "Font.h" -#include "EncFile.h" -#include "InputBuffer.h" -#include "InputReader.h" -#include "FileFinder.h" -#include "Message.h" +#include "Font.hpp" +#include "EncFile.hpp" +#include "InputBuffer.hpp" +#include "InputReader.hpp" +#include "FileFinder.hpp" +#include "Message.hpp" using namespace std; @@ -40,7 +40,7 @@ EncFile::EncFile (const string &encname) : _encname(encname) const char* EncFile::path () const { - return FileFinder::lookup(_encname+".enc", false); + return FileFinder::instance().lookup(_encname+".enc", false); } @@ -126,7 +126,7 @@ static bool valid_name_char (int c) { /** Returns an entry of the encoding table. * @param[in] c character code * @return character name assigned to character code c*/ -const char* EncFile::charName (UInt32 c) const { +const char* EncFile::charName (uint32_t c) const { if (c < _table.size()) return !_table[c].empty() ? _table[c].c_str() : 0; return 0; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.hpp index 30422cd4412..6296104e0b1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** EncFile.h ** +** EncFile.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,15 +18,14 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_ENCFILE_H -#define DVISVGM_ENCFILE_H +#ifndef ENCFILE_HPP +#define ENCFILE_HPP #include <istream> #include <map> #include <string> #include <vector> -#include "FontEncoding.h" -#include "types.h" +#include "FontEncoding.hpp" class EncFile : public NamedFontEncoding @@ -35,12 +34,12 @@ class EncFile : public NamedFontEncoding EncFile (const std::string &name); void read (); void read (std::istream &is); - int size () const {return _table.size();} - const char* name () const {return _encname.c_str();} - const char* charName (UInt32 c) const; - Character decode (UInt32 c) const {return Character(charName(c));} - bool mapsToCharIndex () const {return false;} - const char* path () const; + int size () const {return _table.size();} + const char* name () const override {return _encname.c_str();} + const char* charName (uint32_t c) const; + Character decode (uint32_t c) const override {return Character(charName(c));} + bool mapsToCharIndex () const override {return false;} + const char* path () const override; private: std::string _encname; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.cpp index 8caae75275a..591da5e6fe9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.cpp @@ -2,7 +2,7 @@ ** FileFinder.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -21,14 +21,12 @@ #include <config.h> #ifdef MIKTEX - #include "MessageException.h" - #include "MiKTeXCom.h" - static MiKTeXCom *miktex=0; + #include "MiKTeXCom.hpp" #else #ifdef KPSE_CXX_UNSAFE extern "C" { #endif - #include <kpathsea/kpathsea.h> + #include <kpathsea/kpathsea.h> #ifdef KPSE_CXX_UNSAFE } #endif @@ -38,40 +36,30 @@ #include <fstream> #include <map> #include <set> -#include "FileFinder.h" -#include "FileSystem.h" -#include "FontMap.h" -#include "Message.h" -#include "Process.h" +#include "FileFinder.hpp" +#include "FileSystem.hpp" +#include "FontMap.hpp" +#include "Message.hpp" +#include "MessageException.hpp" +#include "Process.hpp" -// --------------------------------------------------- +const char *FileFinder::_argv0 = nullptr; +std::string FileFinder::_progname; +bool FileFinder::_enableMktex = false; -static bool _initialized = false; -static bool _mktex_enabled = false; -static std::set<std::string> _additional_dirs; -// --------------------------------------------------- - -static const char* find_file (const std::string &fname, const char *ftype); -static const char* find_mapped_file (std::string fname); -static const char* mktex (const std::string &fname); - - -/** Initializes the file finder. This function must be called before any other - * FileFinder function. +/** Constructs a new file finder. * @param[in] argv0 argv[0] of main() function * @param[in] progname name of application using the FileFinder * @param[in] enable_mktexmf if true, tfm and mf file generation is activated */ -void FileFinder::init (const char *argv0, const char *progname, bool enable_mktexmf) { - if (_initialized) - return; - - _mktex_enabled = enable_mktexmf; +FileFinder::FileFinder () { addLookupDir("."); // always lookup files in the current working directory #ifdef MIKTEX - miktex = new MiKTeXCom; + _miktex.reset(new MiKTeXCom); #else - kpse_set_program_name(argv0, progname); + if (_argv0 == nullptr) + _argv0 = ""; + kpse_set_program_name(_argv0, _progname.c_str()); // enable tfm and mf generation (actually invoked by calls of kpse_make_tex) kpse_set_program_enabled(kpse_tfm_format, 1, kpse_src_env); kpse_set_program_enabled(kpse_mf_format, 1, kpse_src_env); @@ -80,41 +68,26 @@ void FileFinder::init (const char *argv0, const char *progname, bool enable_mkte texlive_gs_init(); #endif #endif - _initialized = true; } -/** Cleans up the FileFinder. This function must be called before leaving the - * application's main() function. */ -void FileFinder::finish () { -#ifdef MIKTEX - if (miktex) { - delete miktex; - miktex = 0; - } -#endif - _initialized = false; +void FileFinder::init (const char *argv0, const char *progname, bool enable_mktexmf) { + _argv0 = argv0; + _progname = progname; + _enableMktex = enable_mktexmf; +} + + +FileFinder& FileFinder::instance () { + static FileFinder instance; + return instance; } /** Returns the version string of the underlying file searching library (kpathsea, MiKTeX) */ -std::string FileFinder::version () { +std::string FileFinder::version () const { #ifdef MIKTEX - bool autoinit=false; - try { - if (!_initialized) { - init("", "", false); - autoinit = true; - } - std::string ret = miktex->getVersion(); - if (autoinit) - finish(); - return ret; - } - catch (MessageException &e) { - if (autoinit) - finish(); - } + return _miktex->getVersion(); #else if (const char *v = strrchr(KPSEVERSION, ' ')) return (std::string(KPSEVERSION).substr(0, 9) == "kpathsea ") ? v+1 : KPSEVERSION; @@ -126,7 +99,7 @@ std::string FileFinder::version () { void FileFinder::addLookupDir (const std::string &path) { - _additional_dirs.insert(path); + _additionalDirs.insert(path); } @@ -135,18 +108,18 @@ void FileFinder::addLookupDir (const std::string &path) { * @param[in] fname name of file to look up * @param[in] ftype expected file format of file fname; if 0, it's derived from the filename suffix * @return file path on success, 0 otherwise */ -static const char* find_file (const std::string &fname, const char *ftype) { - if (!_initialized || fname.empty()) +const char* FileFinder::findFile (const std::string &fname, const char *ftype) const { + if (fname.empty()) return 0; static std::string buf; // try to lookup the file in the additionally specified directories - for (std::set<std::string>::iterator it=_additional_dirs.begin(); it != _additional_dirs.end(); ++it) { - if (it->at(0) == '/') + for (const std::string &dir : _additionalDirs) { + if (dir[0] == '/') buf.clear(); else buf = FileSystem::getcwd()+"/"; - buf += (*it) + "/" + fname; + buf += dir + "/" + fname; if (FileSystem::exists(buf)) return buf.c_str(); } @@ -164,7 +137,7 @@ static const char* find_file (const std::string &fname, const char *ftype) { #ifdef MIKTEX if (ext == "dll" || ext == "exe") { // lookup dll and exe files in the MiKTeX bin directory first - buf = miktex->getBinDir() + "/" + fname; + buf = _miktex->getBinDir() + "/" + fname; if (FileSystem::exists(buf)) return buf.c_str(); } @@ -177,7 +150,7 @@ static const char* find_file (const std::string &fname, const char *ftype) { return buf.empty() ? 0 : buf.c_str(); } try { - return miktex->findFile(fname.c_str()); + return _miktex->findFile(fname.c_str()); } catch (const MessageException &e) { return 0; @@ -193,23 +166,22 @@ static const char* find_file (const std::string &fname, const char *ftype) { return 0; } #endif - static std::map<std::string, kpse_file_format_type> types; - if (types.empty()) { - types["tfm"] = kpse_tfm_format; - types["pfb"] = kpse_type1_format; - types["vf"] = kpse_vf_format; - types["mf"] = kpse_mf_format; - types["ttc"] = kpse_truetype_format; - types["ttf"] = kpse_truetype_format; - types["otf"] = kpse_opentype_format; - types["map"] = kpse_fontmap_format; - types["cmap"] = kpse_cmap_format; - types["sty"] = kpse_tex_format; - types["enc"] = kpse_enc_format; - types["pro"] = kpse_tex_ps_header_format; - types["sfd"] = kpse_sfd_format; - } - std::map<std::string, kpse_file_format_type>::iterator it = types.find(ext.c_str()); + static std::map<std::string, kpse_file_format_type> types = { + {"tfm", kpse_tfm_format}, + {"pfb", kpse_type1_format}, + {"vf", kpse_vf_format}, + {"mf", kpse_mf_format}, + {"ttc", kpse_truetype_format}, + {"ttf", kpse_truetype_format}, + {"otf", kpse_opentype_format}, + {"map", kpse_fontmap_format}, + {"cmap", kpse_cmap_format}, + {"sty", kpse_tex_format}, + {"enc", kpse_enc_format}, + {"pro", kpse_tex_ps_header_format}, + {"sfd", kpse_sfd_format}, + }; + auto it = types.find(ext.c_str()); if (it == types.end()) return 0; @@ -230,7 +202,7 @@ static const char* find_file (const std::string &fname, const char *ftype) { * file can be found under this name. * @param[in] fname name of file to look up * @return file path on success, 0 otherwise */ -static const char* find_mapped_file (std::string fname) { +const char* FileFinder::findMappedFile (std::string fname) const { size_t pos = fname.rfind('.'); if (pos == std::string::npos) return 0; @@ -239,10 +211,10 @@ static const char* find_mapped_file (std::string fname) { if (const FontMap::Entry *entry = FontMap::instance().lookup(base)) { const char *path=0; if (entry->fontname.find('.') != std::string::npos) // does the mapped filename has an extension? - path = find_file(entry->fontname, 0); // look for that file + path = findFile(entry->fontname, 0); // look for that file else { // otherwise, use extension of unmapped file fname = entry->fontname + "." + ext; - (path = find_file(fname, 0)) || (path = mktex(fname)); + (path = findFile(fname, 0)) || (path = mktex(fname)); } return path; } @@ -253,12 +225,9 @@ static const char* find_mapped_file (std::string fname) { /** Runs external mktexFOO tool to create missing tfm or mf file. * @param[in] fname name of file to build * @return file path on success, 0 otherwise */ -static const char* mktex (const std::string &fname) { - if (!_initialized) - return 0; - +const char* FileFinder::mktex (const std::string &fname) const { size_t pos = fname.rfind('.'); - if (!_mktex_enabled || pos == std::string::npos) + if (!_enableMktex || pos == std::string::npos) return 0; std::string ext = fname.substr(pos+1); // file extension @@ -270,7 +239,7 @@ static const char* mktex (const std::string &fname) { // maketfm and makemf are located in miktex/bin which is in the search PATH std::string toolname = (ext == "tfm" ? "miktex-maketfm" : "miktex-makemf"); system((toolname+".exe "+fname).c_str()); - path = find_file(fname, 0); + path = findFile(fname, 0); #else kpse_file_format_type type = (ext == "tfm" ? kpse_tfm_format : kpse_mf_format); path = kpse_make_tex(type, fname.c_str()); @@ -290,9 +259,9 @@ static const char* mktex (const std::string &fname) { * @param[in] ftype type/format of file to look up * @param[in] extended if true, use fontmap lookup and mktexFOO calls * @return path to file on success, 0 otherwise */ -const char* FileFinder::lookup (const std::string &fname, const char *ftype, bool extended) { +const char* FileFinder::lookup (const std::string &fname, const char *ftype, bool extended) const { const char *path; - if ((path = find_file(fname, ftype)) || (extended && ((path = find_mapped_file(fname)) || (path = mktex(fname))))) + if ((path = findFile(fname, ftype)) || (extended && ((path = findMappedFile(fname)) || (path = mktex(fname))))) return path; return 0; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.h deleted file mode 100644 index ec9cc1f549d..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.h +++ /dev/null @@ -1,36 +0,0 @@ -/************************************************************************* -** FileFinder.h ** -** ** -** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** published by the Free Software Foundation; either version 3 of ** -** the License, or (at your option) any later version. ** -** ** -** This program is distributed in the hope that it will be useful, but ** -** WITHOUT ANY WARRANTY; without even the implied warranty of ** -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** -** GNU General Public License for more details. ** -** ** -** You should have received a copy of the GNU General Public License ** -** along with this program; if not, see <http://www.gnu.org/licenses/>. ** -*************************************************************************/ - -#ifndef DVISVGM_KPSFILEFINDER_H -#define DVISVGM_KPSFILEFINDER_H - -#include <string> - -struct FileFinder -{ - static void init (const char *argv0, const char *progname, bool enable_mktexmf); - static void finish (); - static std::string version (); - static void addLookupDir (const std::string &path); - static const char* lookup (const std::string &fname, const char *ftype, bool extended=true); - static const char* lookup (const std::string &fname, bool extended=true) {return lookup(fname, 0, extended);} -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.hpp new file mode 100644 index 00000000000..cc88e52d57f --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.hpp @@ -0,0 +1,56 @@ +/************************************************************************* +** FileFinder.hpp ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef FILEFINDER_HPP +#define FILEFINDER_HPP + +#include <memory> +#include <set> +#include <string> + +class MiKTeXCom; + +class FileFinder +{ + public: + static void init (const char *argv0, const char *progname, bool enable_mktexmf); + static FileFinder& instance (); + std::string version () const; + void addLookupDir (const std::string &path); + const char* lookup (const std::string &fname, const char *ftype, bool extended=true) const; + const char* lookup (const std::string &fname, bool extended=true) const {return lookup(fname, 0, extended);} + + protected: + FileFinder (); + const char* findFile (const std::string &fname, const char *ftype) const; + const char* findMappedFile (std::string fname) const; + const char* mktex (const std::string &fname) const; + + private: + static const char *_argv0; + static std::string _progname; + static bool _enableMktex; + std::set<std::string> _additionalDirs; +#ifdef MIKTEX + std::unique_ptr<MiKTeXCom> _miktex; +#endif +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.cpp index 30b32f81d1f..9f9b295ad62 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.cpp @@ -2,7 +2,7 @@ ** FilePath.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -20,10 +20,10 @@ #include <config.h> #include <cctype> -#include "FilePath.h" -#include "FileSystem.h" -#include "MessageException.h" -#include "macros.h" +#include "FilePath.hpp" +#include "FileSystem.hpp" +#include "MessageException.hpp" +#include "utility.hpp" using namespace std; @@ -41,7 +41,7 @@ static string& single_slashes (string &str) { static char strip_drive_letter (string &path) { char letter = 0; if (path.length() >= 2 && path[1] == ':' && isalpha(path[0])) { - letter = tolower(path[0]); + letter = path[0]; path.erase(0, 2); } return letter; @@ -66,12 +66,19 @@ static char adapt_current_path (string &path, char target_drive) { return target_drive; } +#endif -static void tolower (string &str) { - for (size_t i=0; i < str.length(); ++i) - str[i] = tolower(str[i]); -} + +bool FilePath::Directory::operator == (const Directory &dir) const { + string dirstr1 = _dirstr; + string dirstr2 = dir._dirstr; +#ifdef _WIN32 + // letter case is not significant on Windows systems + util::tolower(dirstr1); + util::tolower(dirstr2); #endif + return dirstr1 == dirstr2; +} /** Constructs a FilePath object from a given path. Relative paths are @@ -86,7 +93,7 @@ FilePath::FilePath (const string &path) { * @param[in] path absolute or relative path to a file or directory * @param[in] isfile true if 'path' references a file, false if a directory is referenced * @param[in] current_dir if 'path' is a relative path expression it will be related to 'current_dir' */ -FilePath::FilePath (const string &path, bool isfile, string current_dir) { +FilePath::FilePath (const string &path, bool isfile, const string ¤t_dir) { init(path, isfile, current_dir); } @@ -99,7 +106,6 @@ void FilePath::init (string path, bool isfile, string current_dir) { single_slashes(path); single_slashes(current_dir); #ifdef _WIN32 - tolower(path); path = FileSystem::adaptPathSeperators(path); _drive = strip_drive_letter(path); #endif @@ -114,7 +120,6 @@ void FilePath::init (string path, bool isfile, string current_dir) { if (current_dir.empty()) current_dir = FileSystem::getcwd(); #ifdef _WIN32 - tolower(current_dir); _drive = adapt_current_path(current_dir, _drive); #endif if (!path.empty()) { @@ -132,13 +137,13 @@ void FilePath::init (string path, bool isfile, string current_dir) { } path.insert(0, current_dir + "/"); string elem; - FORALL (path, string::const_iterator, it) { - if (*it == '/') { + for (char c : path) { + if (c != '/') + elem += c; + else { add(elem); elem.clear(); } - else - elem += *it; } add(elem); } @@ -200,9 +205,8 @@ string FilePath::basename () const { * @return the absolute path string */ string FilePath::absolute (bool with_filename) const { string path; - FORALL (_dirs, ConstIterator, it) { - path += "/" + *it; - } + for (const Directory &dir : _dirs) + path += "/" + string(dir); if (path.empty()) path = "/"; if (with_filename && !_fname.empty()) @@ -233,17 +237,17 @@ string FilePath::relative (string reldir, bool with_filename) const { FilePath rel(reldir, false); string path; #ifdef _WIN32 - if (rel._drive && _drive && rel._drive != _drive) + if (rel._drive && _drive && tolower(rel._drive) != tolower(_drive)) path += string(1, _drive) + ":"; #endif - ConstIterator i = _dirs.begin(); - ConstIterator j = rel._dirs.begin(); - while (i != _dirs.end() && j != rel._dirs.end() && *i == *j) - ++i, ++j; - for (; j != rel._dirs.end(); ++j) + auto it1 = _dirs.begin(); + auto it2 = rel._dirs.begin(); + while (it1 != _dirs.end() && it2 != rel._dirs.end() && *it1 == *it2) + ++it1, ++it2; + for (; it2 != rel._dirs.end(); ++it2) path += "../"; - for (; i != _dirs.end(); ++i) - path += *i + "/"; + for (; it1 != _dirs.end(); ++it1) + path += string(*it1) + "/"; if (!path.empty()) path.erase(path.length()-1, 1); // remove trailing slash if (with_filename && !_fname.empty()) { @@ -255,4 +259,3 @@ string FilePath::relative (string reldir, bool with_filename) const { path = "."; return single_slashes(path); } - diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.hpp index 368c92585fa..4f73324a27a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** FilePath.h ** +** FilePath.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,20 +18,32 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_FILEPATH_H -#define DVISVGM_FILEPATH_H +#ifndef FILEPATH_HPP +#define FILEPATH_HPP #include <string> +#include <utility> #include <vector> class FilePath { - typedef std::vector<std::string> Directories; - typedef Directories::iterator Iterator; - typedef Directories::const_iterator ConstIterator; + class Directory { + public: + Directory (const std::string &dir) : _dirstr(dir) {} + Directory (std::string &&dir) : _dirstr(std::move(dir)) {} + bool operator == (const Directory &dir) const; + bool operator != (const Directory &dir) const {return !(*this == dir);} + explicit operator std::string () const {return _dirstr;} + + private: + std::string _dirstr; + }; + + typedef std::vector<Directory> Directories; public: FilePath (const std::string &path); - FilePath (const std::string &path, bool isfile, std::string current_dir=""); + FilePath (const std::string &path, bool isfile) : FilePath(path, isfile, "") {} + FilePath (const std::string &path, bool isfile, const std::string ¤t_dir); std::string absolute (bool with_filename=true) const; std::string relative (std::string reldir="", bool with_filename=true) const; std::string basename () const; @@ -55,5 +67,4 @@ class FilePath #endif }; - #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp index a78eeaa0776..8c5386ac8d5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp @@ -2,7 +2,7 @@ ** FileSystem.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,11 +19,13 @@ *************************************************************************/ #include <config.h> +#include <algorithm> #include <cstdlib> #include <cstring> #include <fstream> -#include "FileSystem.h" -#include "macros.h" +#include "FileSystem.hpp" +#include "utility.hpp" +#include "version.hpp" #ifdef HAVE_UNISTD_H #include <unistd.h> @@ -48,6 +50,43 @@ using namespace std; #endif +FileSystem FileSystem::_fs; +string FileSystem::TMPDIR; +const char *FileSystem::TMPSUBDIR = nullptr; + + +/** Private wrapper function for mkdir: creates a single folder. + * @param[in] dir folder name + * @return true on success */ +static bool s_mkdir (const string &dirname) { + bool success = true; + if (!FileSystem::exists(dirname)) { +#ifdef _WIN32 + success = (_mkdir(dirname.c_str()) == 0); +#else + success = (::mkdir(dirname.c_str(), 0775) == 0); +#endif + } + return success; +} + + +static bool inline s_rmdir (const string &dirname) { +#ifdef _WIN32 + return (_rmdir(dirname.c_str()) == 0); +#else + return (::rmdir(dirname.c_str()) == 0); +#endif +} + + +FileSystem::~FileSystem () { + // remove the subdirectory from the system's temp folder (if empty) + if (TMPSUBDIR) + s_rmdir(tmpdir()); +} + + bool FileSystem::remove (const string &fname) { return unlink(fname.c_str()) == 0; } @@ -80,13 +119,13 @@ bool FileSystem::rename (const string &oldname, const string &newname) { } -UInt64 FileSystem::filesize (const string &fname) { +uint64_t FileSystem::filesize (const string &fname) { #ifdef _WIN32 // unfortunately, stat doesn't work properly under Windows // so we have to use this freaky code WIN32_FILE_ATTRIBUTE_DATA attr; GetFileAttributesExA(fname.c_str(), GetFileExInfoStandard, &attr); - return (static_cast<UInt64>(attr.nFileSizeHigh) << (8*sizeof(attr.nFileSizeLow))) | attr.nFileSizeLow; + return (static_cast<uint64_t>(attr.nFileSizeHigh) << (8*sizeof(attr.nFileSizeLow))) | attr.nFileSizeLow; #else struct stat attr; return (stat(fname.c_str(), &attr) == 0) ? attr.st_size : 0; @@ -95,9 +134,7 @@ UInt64 FileSystem::filesize (const string &fname) { string FileSystem::adaptPathSeperators (string path) { - for (size_t i=0; i < path.length(); i++) - if (path[i] == PATHSEP) - path[i] = '/'; + std::replace(path.begin(), path.end(), PATHSEP, '/'); return path; } @@ -121,7 +158,7 @@ bool FileSystem::chdir (const std::string &dirname) { #ifdef _WIN32 success = (_chdir(cdirname) == 0); #else - success = (chdir(cdirname) == 0); + success = (::chdir(cdirname) == 0); #endif } return success; @@ -152,39 +189,38 @@ const char* FileSystem::userdir () { } -/** Private wrapper function for mkdir: creates a single folder. - * @param[in] dir folder name - * @return true on success */ -static bool s_mkdir (const string &dirname) { - bool success = true; - if (!FileSystem::exists(dirname)) { +/** Returns the path of the temporary folder. */ +string FileSystem::tmpdir () { + string ret; + if (!TMPDIR.empty()) + ret = TMPDIR; + else { #ifdef _WIN32 - success = (_mkdir(dirname.c_str()) == 0); + char buf[MAX_PATH]; + if (GetTempPath(MAX_PATH, buf)) + ret = adaptPathSeperators(buf); + else + ret = "."; #else - success = (mkdir(dirname.c_str(), 0775) == 0); + if (const char *path = getenv("TMPDIR")) + ret = path; + else + ret = "/tmp"; #endif + if (ret.back() == '/') + ret.pop_back(); + static bool initialized=false; + if (!initialized && ret != ".") { + TMPSUBDIR = PROGRAM_NAME; + s_mkdir(ret + "/" + TMPSUBDIR); + initialized = true; + } + if (TMPSUBDIR) + ret += string("/") + TMPSUBDIR; } - return success; -} - - -static bool inline s_rmdir (const string &dirname) { -#ifdef _WIN32 - return (_rmdir(dirname.c_str()) == 0); -#else - return (rmdir(dirname.c_str()) == 0); -#endif -} - - -/** Removes leading and trailing whitespace from a string. */ -static string trim (const string &str) { - int first=0, last=str.length()-1; - while (isspace(str[first])) - first++; - while (isspace(str[last])) - last--; - return str.substr(first, last-first+1); + if (!ret.empty() && ret.back() != '/') + ret += '/'; + return ret; } @@ -196,7 +232,7 @@ bool FileSystem::mkdir (const string &dirname) { bool success = false; if (const char *cdirname = dirname.c_str()) { success = true; - const string dirstr = adaptPathSeperators(trim(cdirname)); + const string dirstr = adaptPathSeperators(util::trim(cdirname)); for (size_t pos=1; success && (pos = dirstr.find('/', pos)) != string::npos; pos++) success &= s_mkdir(dirstr.substr(0, pos)); success &= s_mkdir(dirstr); @@ -311,7 +347,7 @@ int FileSystem::collect (const char *dirname, vector<string> &entries) { string path = string(dirname)+"/"+fname; string typechar = isFile(path) ? "f" : isDirectory(path) ? "d" : "?"; if (fname != "." && fname != "..") - entries.push_back(typechar+fname); + entries.emplace_back(typechar+fname); ready = !FindNextFile(h, &data); } FindClose(h); @@ -323,12 +359,10 @@ int FileSystem::collect (const char *dirname, vector<string> &entries) { string path = string(dirname)+"/"+fname; string typechar = isFile(path) ? "f" : isDirectory(path) ? "d" : "?"; if (fname != "." && fname != "..") - entries.push_back(typechar+fname); + entries.emplace_back(typechar+fname); } closedir(dir); } #endif return entries.size(); } - - diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.h deleted file mode 100644 index 4e36653f1fd..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.h +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************* -** FileSystem.h ** -** ** -** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** published by the Free Software Foundation; either version 3 of ** -** the License, or (at your option) any later version. ** -** ** -** This program is distributed in the hope that it will be useful, but ** -** WITHOUT ANY WARRANTY; without even the implied warranty of ** -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** -** GNU General Public License for more details. ** -** ** -** You should have received a copy of the GNU General Public License ** -** along with this program; if not, see <http://www.gnu.org/licenses/>. ** -*************************************************************************/ - -#ifndef DVISVGM_FILESYSTEM_H -#define DVISVGM_FILESYSTEM_H - -#include <string> -#include <vector> -#include "types.h" - -struct FileSystem -{ - static bool remove (const std::string &fname); - static bool rename (const std::string &oldname, const std::string &newname); - static bool copy (const std::string &src, const std::string &dest, bool remove_src=false); - static UInt64 filesize (const std::string &fname); - static std::string adaptPathSeperators (std::string path); - static std::string getcwd (); - static bool chdir (const std::string &dir); - static bool exists (const std::string &fname); - static bool mkdir (const std::string &dirname); - static bool rmdir (const std::string &dirname); - static int collect (const char *dirname, std::vector<std::string> &entries); - static bool isDirectory (const std::string &fname); - static bool isFile (const std::string &fname); - static const char* userdir (); - static const char* DEVNULL; - static const char PATHSEP; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.hpp new file mode 100644 index 00000000000..798ca982e74 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.hpp @@ -0,0 +1,59 @@ +/************************************************************************* +** FileSystem.hpp ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef FILESYSTEM_HPP +#define FILESYSTEM_HPP + +#include <string> +#include <vector> + +class FileSystem +{ + public: + ~FileSystem (); + static bool remove (const std::string &fname); + static bool rename (const std::string &oldname, const std::string &newname); + static bool copy (const std::string &src, const std::string &dest, bool remove_src=false); + static uint64_t filesize (const std::string &fname); + static std::string adaptPathSeperators (std::string path); + static std::string getcwd (); + static std::string tmpdir (); + static bool chdir (const std::string &dir); + static bool exists (const std::string &fname); + static bool mkdir (const std::string &dirname); + static bool rmdir (const std::string &dirname); + static int collect (const char *dirname, std::vector<std::string> &entries); + static bool isDirectory (const std::string &fname); + static bool isFile (const std::string &fname); + static const char* userdir (); + static const char* DEVNULL; ///< name of NULL device + static const char PATHSEP; ///< character used to separate folders/files in a path + static std::string TMPDIR; ///< set path to temporary folder + + protected: + FileSystem () =default; + bool system_tmpdir_available (); + static const char* TMPSUBDIR; ///< subdirectory of the system's temporary folder + + private: + static FileSystem _fs; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FixWord.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FixWord.hpp new file mode 100644 index 00000000000..7f6a5ebd298 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FixWord.hpp @@ -0,0 +1,38 @@ +/************************************************************************* +** FixWord.hpp ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef FIXWORD_HPP +#define FIXWORD_HPP + +#include <cstdint> + +class FixWord { + public: + FixWord () : _value(0) {} + FixWord (int32_t fw) : _value(fw) {} + explicit operator double () const {return double(_value)/(1 << 20);} + bool operator < (FixWord fw) const {return _value < fw._value;} + bool operator == (FixWord fw) const {return _value == fw._value;} + + private: + int32_t _value; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp index 062f1a640bb..9f371036f53 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp @@ -2,7 +2,7 @@ ** Font.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -22,22 +22,22 @@ #include <cstdlib> #include <fstream> #include <sstream> -#include "CMap.h" -#include "FileFinder.h" -#include "FileSystem.h" -#include "Font.h" -#include "FontEngine.h" -#include "Message.h" -#include "MetafontWrapper.h" -#include "SignalHandler.h" -#include "Subfont.h" -#include "Unicode.h" +#include "CMap.hpp" +#include "FileFinder.hpp" +#include "FileSystem.hpp" +#include "Font.hpp" +#include "FontEngine.hpp" +#include "Message.hpp" +#include "MetafontWrapper.hpp" +#include "SignalHandler.hpp" +#include "Subfont.hpp" +#include "Unicode.hpp" using namespace std; -UInt32 Font::unicode (UInt32 c) const { +uint32_t Font::unicode (uint32_t c) const { return Unicode::charToCodepoint(c); } @@ -98,34 +98,29 @@ const char* Font::filename () const { /////////////////////////////////////////////////////////////////////////////////////// -TFMFont::TFMFont (string name, UInt32 cs, double ds, double ss) - : _metrics(0), _fontname(name), _checksum(cs), _dsize(ds), _ssize(ss) +TFMFont::TFMFont (const string &name, uint32_t cs, double ds, double ss) + : _fontname(name), _checksum(cs), _dsize(ds), _ssize(ss) { } -TFMFont::~TFMFont () { - delete _metrics; -} - - /** Returns a font metrics object for the current font. * @throw FontException if TFM file can't be found */ const FontMetrics* TFMFont::getMetrics () const { if (!_metrics) { try { - _metrics = FontMetrics::read(_fontname.c_str()); + _metrics.reset(FontMetrics::read(_fontname.c_str())); if (!_metrics) { - _metrics = new NullFontMetric; + _metrics.reset(new NullFontMetric); Message::wstream(true) << "can't find "+_fontname+".tfm\n"; } } catch (FontMetricException &e) { - _metrics = new NullFontMetric; + _metrics.reset(new NullFontMetric); Message::wstream(true) << e.what() << " in " << _fontname << ".tfm\n"; } } - return _metrics; + return _metrics.get(); } @@ -168,35 +163,35 @@ double PhysicalFont::METAFONT_MAG = 4; FontCache PhysicalFont::_cache; -Font* PhysicalFont::create (string name, UInt32 checksum, double dsize, double ssize, PhysicalFont::Type type) { +Font* PhysicalFont::create (const string &name, uint32_t checksum, double dsize, double ssize, PhysicalFont::Type type) { return new PhysicalFontImpl(name, 0, checksum, dsize, ssize, type); } -Font* PhysicalFont::create (string name, int fontindex, UInt32 checksum, double dsize, double ssize) { - return new PhysicalFontImpl(name, fontindex, checksum, dsize, ssize, PhysicalFont::TTC); +Font* PhysicalFont::create (const string &name, int fontindex, uint32_t checksum, double dsize, double ssize) { + return new PhysicalFontImpl(name, fontindex, checksum, dsize, ssize, PhysicalFont::Type::TTC); } const char* PhysicalFont::path () const { const char *ext=0; switch (type()) { - case OTF: ext = "otf"; break; - case PFB: ext = "pfb"; break; - case TTC: ext = "ttc"; break; - case TTF: ext = "ttf"; break; - case MF : ext = "mf"; break; + case Type::OTF: ext = "otf"; break; + case Type::PFB: ext = "pfb"; break; + case Type::TTC: ext = "ttc"; break; + case Type::TTF: ext = "ttf"; break; + case Type::MF : ext = "mf"; break; default : ext = 0; } if (ext) - return FileFinder::lookup(name()+"."+ext); - return FileFinder::lookup(name()); + return FileFinder::instance().lookup(name()+"."+ext); + return FileFinder::instance().lookup(name()); } /** Returns true if this font is CID-based. */ bool PhysicalFont::isCIDFont () const { - if (type() == MF) + if (type() == Type::MF) return false; FontEngine::instance().setFont(*this); return FontEngine::instance().isCIDFont(); @@ -207,7 +202,7 @@ bool PhysicalFont::isCIDFont () const { * @param[out] charMapIDs IDs of the found character maps * @return number of found character maps */ int PhysicalFont::collectCharMapIDs (std::vector<CharMapID> &charMapIDs) const { - if (type() == MF) + if (type() == Type::MF) return 0; FontEngine::instance().setFont(*this); return FontEngine::instance().getCharMapIDs(charMapIDs); @@ -218,7 +213,7 @@ int PhysicalFont::collectCharMapIDs (std::vector<CharMapID> &charMapIDs) const { * address the correct character in the font. * @param[in] c DVI character to decode * @return target character code or name */ -Character PhysicalFont::decodeChar (UInt32 c) const { +Character PhysicalFont::decodeChar (uint32_t c) const { if (const FontEncoding *enc = encoding()) return enc->decode(c); return Character(Character::CHRCODE, c); @@ -230,7 +225,7 @@ Character PhysicalFont::decodeChar (UInt32 c) const { * lower left corner of this square, while the upper right corner is located at (m,m), where m * is an integer value defined with the font, and returned by this function. */ int PhysicalFont::unitsPerEm() const { - if (type() == MF) + if (type() == Type::MF) return 1000; FontEngine::instance().setFont(*this); return FontEngine::instance().getUnitsPerEM(); @@ -238,7 +233,7 @@ int PhysicalFont::unitsPerEm() const { int PhysicalFont::hAdvance () const { - if (type() == MF) + if (type() == Type::MF) return 0; FontEngine::instance().setFont(*this); return FontEngine::instance().getHAdvance(); @@ -246,7 +241,7 @@ int PhysicalFont::hAdvance () const { double PhysicalFont::hAdvance (int c) const { - if (type() == MF) + if (type() == Type::MF) return unitsPerEm()*charWidth(c)/designSize(); FontEngine::instance().setFont(*this); if (const FontMap::Entry *entry = fontMapEntry()) @@ -257,7 +252,7 @@ double PhysicalFont::hAdvance (int c) const { double PhysicalFont::vAdvance (int c) const { - if (type() == MF) + if (type() == Type::MF) return unitsPerEm()*charWidth(c)/designSize(); FontEngine::instance().setFont(*this); if (const FontMap::Entry *entry = fontMapEntry()) @@ -268,7 +263,7 @@ double PhysicalFont::vAdvance (int c) const { string PhysicalFont::glyphName (int c) const { - if (type() == MF) + if (type() == Type::MF) return ""; FontEngine::instance().setFont(*this); if (const FontMap::Entry *entry = fontMapEntry()) @@ -283,24 +278,26 @@ double PhysicalFont::scaledAscent() const { } +/** Returns the unscaled ascender of the font in design units. */ int PhysicalFont::ascent () const { - if (type() == MF) - return 0; + if (type() == Type::MF) + return getMetrics() ? getMetrics()->getAscent()*unitsPerEm()/getMetrics()->getQuad() : 0; FontEngine::instance().setFont(*this); return FontEngine::instance().getAscender(); } +/** Returns the unscaled descender of the font in design units. */ int PhysicalFont::descent () const { - if (type() == MF) - return 0; + if (type() == Type::MF) + return getMetrics() ? getMetrics()->getDescent()*unitsPerEm()/getMetrics()->getQuad() : 0; FontEngine::instance().setFont(*this); return FontEngine::instance().getDescender(); } std::string PhysicalFont::familyName () const { - if (type() == MF) + if (type() == Type::MF) return ""; FontEngine::instance().setFont(*this); const char *family = FontEngine::instance().getFamilyName(); @@ -309,7 +306,7 @@ std::string PhysicalFont::familyName () const { std::string PhysicalFont::styleName () const { - if (type() == MF) + if (type() == Type::MF) return ""; FontEngine::instance().setFont(*this); const char *style = FontEngine::instance().getStyleName(); @@ -323,8 +320,8 @@ std::string PhysicalFont::styleName () const { * @param[out] glyph path segments of the glyph outline * @param[in] cb optional callback object for tracer class * @return true if outline could be computed */ -bool PhysicalFont::getGlyph (int c, GraphicsPath<Int32> &glyph, GFGlyphTracer::Callback *cb) const { - if (type() == MF) { +bool PhysicalFont::getGlyph (int c, GraphicsPath<int32_t> &glyph, GFGlyphTracer::Callback *cb) const { + if (type() == Type::MF) { const Glyph *cached_glyph=0; if (CACHE_PATH) { _cache.write(CACHE_PATH); @@ -376,8 +373,8 @@ bool PhysicalFont::getGlyph (int c, GraphicsPath<Int32> &glyph, GFGlyphTracer::C * @return true on success */ bool PhysicalFont::createGF (string &gfname) const { SignalHandler::instance().check(); - gfname = name()+".gf"; - MetafontWrapper mf(name()); + gfname = FileSystem::tmpdir()+name()+".gf"; + MetafontWrapper mf(name(), FileSystem::tmpdir()); bool ok = mf.make("ljfour", METAFONT_MAG); // call Metafont if necessary return ok && mf.success() && getMetrics(); } @@ -389,7 +386,7 @@ bool PhysicalFont::createGF (string &gfname) const { * @return number of glyphs traced */ int PhysicalFont::traceAllGlyphs (bool includeCached, GFGlyphTracer::Callback *cb) const { int count = 0; - if (type() == MF && CACHE_PATH) { + if (type() == Type::MF && CACHE_PATH) { if (const FontMetrics *metrics = getMetrics()) { int fchar = metrics->firstChar(); int lchar = metrics->lastChar(); @@ -460,7 +457,7 @@ bool PhysicalFont::getExactGlyphBox (int c, GlyphMetrics &metrics, bool vertical } -Font* VirtualFont::create (string name, UInt32 checksum, double dsize, double ssize) { +Font* VirtualFont::create (const string &name, uint32_t checksum, double dsize, double ssize) { return new VirtualFontImpl(name, checksum, dsize, ssize); } @@ -468,7 +465,7 @@ Font* VirtualFont::create (string name, UInt32 checksum, double dsize, double ss ////////////////////////////////////////////////////////////////////////////// -PhysicalFontImpl::PhysicalFontImpl (string name, int fontindex, UInt32 cs, double ds, double ss, PhysicalFont::Type type) +PhysicalFontImpl::PhysicalFontImpl (const string &name, int fontindex, uint32_t cs, double ds, double ss, PhysicalFont::Type type) : TFMFont(name, cs, ds, ss), _filetype(type), _fontIndex(fontindex), _fontMapEntry(Font::fontMapEntry()), _encodingPair(Font::encoding()), _localCharMap(0) { @@ -501,7 +498,7 @@ bool PhysicalFontImpl::findAndAssignBaseFontMap () { else return false; } - else if (type() != MF) { + else if (type() != Type::MF) { FontEngine::instance().setFont(*this); if ((_localCharMap = FontEngine::instance().createCustomToUnicodeMap()) != 0) _charmapID = FontEngine::instance().setCustomCharMap(); @@ -513,14 +510,14 @@ bool PhysicalFontImpl::findAndAssignBaseFontMap () { /** Returns the Unicode point for a given DVI character. */ -UInt32 PhysicalFontImpl::unicode (UInt32 c) const { - if (type() == MF) +uint32_t PhysicalFontImpl::unicode (uint32_t c) const { + if (type() == Type::MF) return Font::unicode(c); Character chr = decodeChar(c); - if (type() == PFB) { + if (type() == Type::PFB) { // try to get the Unicode point from the character name string glyphname = glyphName(c); - UInt32 codepoint; + uint32_t codepoint; if (!glyphname.empty() && (codepoint = Unicode::aglNameToCodepoint(glyphname)) != 0) return codepoint; if (c <= 0x1900) // does character code c fit into Private Use Zone U+E000? @@ -534,7 +531,7 @@ UInt32 PhysicalFontImpl::unicode (UInt32 c) const { return Unicode::charToCodepoint(chr.number()); if (_localCharMap) { - if (UInt32 mapped_char = _localCharMap->valueAt(chr.number())) + if (uint32_t mapped_char = _localCharMap->valueAt(chr.number())) return mapped_char; } // No Unicode equivalent found in the font file. @@ -546,11 +543,12 @@ UInt32 PhysicalFontImpl::unicode (UInt32 c) const { /** Delete all temporary font files created by Metafont. */ void PhysicalFontImpl::tidy () const { - if (type() == MF) { + if (type() == Type::MF) { const char *ext[] = {"gf", "tfm", "log", 0}; + string fname = FileSystem::tmpdir()+name(); for (const char **p=ext; *p; ++p) { - if (FileSystem::exists(name()+"."+(*p))) - FileSystem::remove(name()+"."+(*p)); + if (FileSystem::exists(fname+"."+(*p))) + FileSystem::remove(fname+"."+(*p)); } } } @@ -583,14 +581,14 @@ PhysicalFont::Type NativeFont::type () const { if (const char *p =strrchr(filepath, '.')) { string ext = p+1; if (ext == "otf") - return PhysicalFont::OTF; + return PhysicalFont::Type::OTF; if (ext == "ttf") - return PhysicalFont::TTF; + return PhysicalFont::Type::TTF; if (ext == "pfb") - return PhysicalFont::PFB; + return PhysicalFont::Type::PFB; } } - return PhysicalFont::UNKNOWN; + return PhysicalFont::Type::UNKNOWN; } @@ -613,7 +611,7 @@ double NativeFont::charHeight (int c) const { double NativeFont::charDepth (int c) const { FontEngine::instance().setFont(*this); int upem = FontEngine::instance().getUnitsPerEM(); - return upem ? (-scaledSize()*FontEngine::instance().getDescender()/upem) : 0; + return upem ? (scaledSize()*FontEngine::instance().getDescender()/upem) : 0; } @@ -628,48 +626,39 @@ bool NativeFontImpl::findAndAssignBaseFontMap () { } -Character NativeFontImpl::decodeChar (UInt32 c) const { +Character NativeFontImpl::decodeChar (uint32_t c) const { return Character(Character::INDEX, c); } -UInt32 NativeFontImpl::unicode (UInt32 c) const { - UInt32 ucode = _toUnicodeMap.valueAt(c); +uint32_t NativeFontImpl::unicode (uint32_t c) const { + uint32_t ucode = _toUnicodeMap.valueAt(c); return Unicode::charToCodepoint(ucode); } ////////////////////////////////////////////////////////////////////////////// -VirtualFontImpl::VirtualFontImpl (string name, UInt32 cs, double ds, double ss) +VirtualFontImpl::VirtualFontImpl (const string &name, uint32_t cs, double ds, double ss) : TFMFont(name, cs, ds, ss) { } -VirtualFontImpl::~VirtualFontImpl () { - // delete dvi vectors received by VFReaderAction - for (map<UInt32, DVIVector*>::iterator i=_charDefs.begin(); i != _charDefs.end(); ++i) - delete i->second; -} - - const char* VirtualFontImpl::path () const { - return FileFinder::lookup(name()+".vf"); + return FileFinder::instance().lookup(name()+".vf"); } -void VirtualFontImpl::assignChar (UInt32 c, DVIVector *dvi) { - if (dvi) { - if (_charDefs.find(c) == _charDefs.end()) - _charDefs[c] = dvi; - else - delete dvi; - } +void VirtualFontImpl::assignChar (uint32_t c, DVIVector &&dvi) { + _charDefs.emplace(c, std::move(dvi)); } -const vector<UInt8>* VirtualFontImpl::getDVI (int c) const { - map<UInt32,DVIVector*>::const_iterator it = _charDefs.find(c); - return (it == _charDefs.end() ? 0 : it->second); +/** Returns the DVI sippet that describes a given character of the virtual font. + * @param[in] c character code + * @return pointer to vector of DVI commands, or 0 if character doesn't exist */ +const vector<uint8_t>* VirtualFontImpl::getDVI (int c) const { + auto it = _charDefs.find(c); + return (it == _charDefs.end() ? 0 : &it->second); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.h deleted file mode 100644 index 0a1c707cda6..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.h +++ /dev/null @@ -1,385 +0,0 @@ -/************************************************************************* -** Font.h ** -** ** -** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** published by the Free Software Foundation; either version 3 of ** -** the License, or (at your option) any later version. ** -** ** -** This program is distributed in the hope that it will be useful, but ** -** WITHOUT ANY WARRANTY; without even the implied warranty of ** -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** -** GNU General Public License for more details. ** -** ** -** You should have received a copy of the GNU General Public License ** -** along with this program; if not, see <http://www.gnu.org/licenses/>. ** -*************************************************************************/ - -#ifndef DVISVGM_FONT_H -#define DVISVGM_FONT_H - -#include <map> -#include <string> -#include <vector> -#include "Character.h" -#include "CharMapID.h" -#include "Color.h" -#include "FontCache.h" -#include "FontEncoding.h" -#include "FontMap.h" -#include "FontMetrics.h" -#include "GFGlyphTracer.h" -#include "Glyph.h" -#include "GraphicsPath.h" -#include "MessageException.h" -#include "RangeMap.h" -#include "ToUnicodeMap.h" -#include "VFActions.h" -#include "VFReader.h" -#include "types.h" - - -struct FontStyle; - - -struct GlyphMetrics -{ - GlyphMetrics () : wl(0), wr(0), h(0), d(0) {} - GlyphMetrics (double wwl, double wwr, double hh, double dd) : wl(wwl), wr(wwr), h(hh), d(dd) {} - double wl, wr, h, d; -}; - - -/** Abstract base for all font classes. */ -class Font { - public: - virtual ~Font () {} - virtual Font* clone (double ds, double sc) const =0; - virtual const Font* uniqueFont () const =0; - virtual std::string name () const =0; - virtual double designSize () const =0; - virtual double scaledSize () const =0; - virtual double scaleFactor () const {return scaledSize()/designSize();} - virtual double charWidth (int c) const =0; - virtual double charDepth (int c) const =0; - virtual double charHeight (int c) const =0; - virtual double italicCorr (int c) const =0; - virtual const FontMetrics* getMetrics () const =0; - virtual const char* path () const =0; - virtual const char* filename () const; - virtual const FontEncoding* encoding () const; - virtual bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=0) const =0; - virtual void getGlyphMetrics (int c, bool vertical, GlyphMetrics &metrics) const; - virtual UInt32 unicode (UInt32 c) const; - virtual void tidy () const {} - virtual bool findAndAssignBaseFontMap () {return true;} - virtual bool verticalLayout () const {return getMetrics() ? getMetrics()->verticalLayout() : false;} - virtual bool verifyChecksums () const {return true;} - virtual int fontIndex () const {return 0;} - virtual const FontStyle* style () const {return 0;} - virtual Color color () const {return Color::BLACK;} - virtual const FontMap::Entry* fontMapEntry () const; -}; - - -/** Empty font without any glyphs. Instances of this class are used - * if no physical or virtual font file can be found. - * The metric values returned by the member functions are based on cmr10. */ -class EmptyFont : public Font { - public: - EmptyFont (std::string name) : _fontname(name) {} - Font* clone (double ds, double sc) const {return new EmptyFont(*this);} - const Font* uniqueFont () const {return this;} - std::string name () const {return _fontname;} - double designSize () const {return 10;} // cmr10 design size in pt - double scaledSize () const {return 10;} // cmr10 scaled size in pt - double charWidth (int c) const {return 9.164;} // width of cmr10's 'M' in pt - double charHeight (int c) const {return 6.833;} // height of cmr10's 'M' in pt - double charDepth (int c) const {return 0;} - double italicCorr (int c) const {return 0;} - const FontMetrics* getMetrics () const {return 0;} - const char* path () const {return 0;} - bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=0) const {return false;} - - private: - std::string _fontname; -}; - - -/** Interface for all physical fonts. */ -class PhysicalFont : public virtual Font { - public: - enum Type {MF, OTF, PFB, TTC, TTF, UNKNOWN}; - - static Font* create (std::string name, UInt32 checksum, double dsize, double ssize, PhysicalFont::Type type); - static Font* create (std::string name, int fontindex, UInt32 checksum, double dsize, double ssize); - virtual Type type () const =0; - virtual bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=0) const; - virtual bool getExactGlyphBox (int c, BoundingBox &bbox, GFGlyphTracer::Callback *cb=0) const; - virtual bool getExactGlyphBox (int c, GlyphMetrics &metrics, bool vertical, GFGlyphTracer::Callback *cb=0) const; - virtual bool isCIDFont () const; - virtual int hAdvance () const; - virtual std::string familyName () const; - virtual std::string styleName () const; - virtual double hAdvance (int c) const; - virtual double vAdvance (int c) const; - std::string glyphName (int c) const; - virtual int unitsPerEm () const; - virtual double scaledAscent () const; - virtual int ascent () const; - virtual int descent () const; - virtual int traceAllGlyphs (bool includeCached, GFGlyphTracer::Callback *cb=0) const; - virtual int collectCharMapIDs (std::vector<CharMapID> &charmapIDs) const; - virtual CharMapID getCharMapID () const =0; - virtual void setCharMapID (const CharMapID &id) {} - virtual Character decodeChar (UInt32 c) const; - const char* path () const; - - protected: - bool createGF (std::string &gfname) const; - - public: - static bool EXACT_BBOX; - static bool KEEP_TEMP_FILES; - static const char *CACHE_PATH; ///< path to cache directory (0 if caching is disabled) - static double METAFONT_MAG; ///< magnification factor for Metafont calls - - protected: - static FontCache _cache; -}; - - -/** Interface for all virtual fonts. */ -class VirtualFont : public virtual Font { - friend class FontManager; - public: - typedef std::vector<UInt8> DVIVector; - - public: - static Font* create (std::string name, UInt32 checksum, double dsize, double ssize); - virtual const DVIVector* getDVI (int c) const =0; - bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=0) const {return false;} - - protected: - virtual void assignChar (UInt32 c, DVIVector *dvi) =0; -}; - - -class TFMFont : public virtual Font { - public: - TFMFont (std::string name, UInt32 checksum, double dsize, double ssize); - ~TFMFont (); - const FontMetrics* getMetrics () const; - std::string name () const {return _fontname;} - double designSize () const {return _dsize;} - double scaledSize () const {return _ssize;} - double charWidth (int c) const; - double charDepth (int c) const; - double charHeight (int c) const; - double italicCorr (int c) const; - bool verifyChecksums () const; - - private: - mutable FontMetrics *_metrics; - std::string _fontname; - UInt32 _checksum; ///< cheksum to be compared with TFM checksum - double _dsize; ///< design size in PS point units - double _ssize; ///< scaled size in PS point units -}; - - -class PhysicalFontProxy : public PhysicalFont { - friend class PhysicalFontImpl; - public: - Font* clone (double ds, double sc) const {return new PhysicalFontProxy(*this, ds, sc);} - const Font* uniqueFont () const {return _pf;} - std::string name () const {return _pf->name();} - double designSize () const {return _dsize;} - double scaledSize () const {return _ssize;} - double charWidth (int c) const {return _pf->charWidth(c);} - double charDepth (int c) const {return _pf->charDepth(c);} - double charHeight (int c) const {return _pf->charHeight(c);} - double italicCorr (int c) const {return _pf->italicCorr(c);} - const FontMetrics* getMetrics () const {return _pf->getMetrics();} - Type type () const {return _pf->type();} - UInt32 unicode (UInt32 c) const {return _pf->unicode(c);} - int fontIndex () const {return _pf->fontIndex();} - const FontStyle* style () const {return _pf->style();} - const FontMap::Entry* fontMapEntry () const {return _pf->fontMapEntry();} - const FontEncoding* encoding () const {return _pf->encoding();} - CharMapID getCharMapID () const {return _pf->getCharMapID();} - int collectCharMapIDs (std::vector<CharMapID> &charmapIDs) const {return _pf->collectCharMapIDs(charmapIDs);} - - protected: - PhysicalFontProxy (const PhysicalFont *font, double ds, double ss) : _pf(font), _dsize(ds), _ssize(ss) {} - PhysicalFontProxy (const PhysicalFontProxy &proxy, double ds, double ss) : _pf(proxy._pf), _dsize(ds), _ssize(ss) {} - - private: - const PhysicalFont *_pf; - double _dsize; ///< design size in PS point units - double _ssize; ///< scaled size in PS point units -}; - - -class PhysicalFontImpl : public PhysicalFont, public TFMFont { - friend class PhysicalFont; - public: - ~PhysicalFontImpl(); - Font* clone (double ds, double ss) const {return new PhysicalFontProxy(this, ds, ss);} - const Font* uniqueFont () const {return this;} - Type type () const {return _filetype;} - int fontIndex() const {return _fontIndex;} - const FontStyle* style () const {return _fontMapEntry ? &_fontMapEntry->style : 0;} - const FontMap::Entry* fontMapEntry () const {return _fontMapEntry;} - const FontEncoding* encoding () const; - UInt32 unicode (UInt32 c) const; - bool findAndAssignBaseFontMap (); - void tidy () const; - CharMapID getCharMapID () const {return _charmapID;} - - protected: - PhysicalFontImpl (std::string name, int fontindex, UInt32 checksum, double dsize, double ssize, PhysicalFont::Type type); - - private: - Type _filetype; - int _fontIndex; - const FontMap::Entry *_fontMapEntry; - FontEncodingPair _encodingPair; - CharMapID _charmapID; ///< ID of the font's charmap to use - const RangeMap *_localCharMap; -}; - - -class NativeFont : public PhysicalFont { - public: - virtual NativeFont* clone (double ptsize, const FontStyle &style, Color color) const =0; - virtual Font* clone (double ds, double sc) const =0; - std::string name () const; - Type type () const; - double designSize () const {return _ptsize;} - double scaledSize () const {return _ptsize;} - double charWidth (int c) const; - double charDepth (int c) const; - double charHeight (int c) const; - double italicCorr (int c) const {return 0;} - const FontMetrics* getMetrics () const {return 0;} - const FontStyle* style () const {return &_style;} - Color color () const {return _color;} - const FontMap::Entry* fontMapEntry () const {return 0;} - static std::string uniqueName (const std::string &path, const FontStyle &style); - - protected: - NativeFont (double ptsize, const FontStyle &style, Color color) : _ptsize(ptsize), _style(style), _color(color) {} - - private: - double _ptsize; ///< font size in PS point units - FontStyle _style; - Color _color; -}; - - -class NativeFontProxy : public NativeFont { - friend class NativeFontImpl; - public: - NativeFont* clone (double ptsize, const FontStyle &style, Color color) const { - return new NativeFontProxy(this, ptsize, style, color); - } - - Font* clone (double ds, double sc) const {return new NativeFontProxy(this , sc, *style(), color());} - const Font* uniqueFont () const {return _nfont;} - const char* path () const {return _nfont->path();} - int fontIndex () const {return _nfont->fontIndex();} - Character decodeChar (UInt32 c) const {return _nfont->decodeChar(c);} - UInt32 unicode (UInt32 c) const {return _nfont->unicode(c);} - CharMapID getCharMapID () const {return _nfont->getCharMapID();} - - protected: - NativeFontProxy (const NativeFont *nfont, double ptsize, const FontStyle &style, Color color) - : NativeFont(ptsize, style, color), _nfont(nfont) {} - - private: - const NativeFont *_nfont; -}; - - -class NativeFontImpl : public NativeFont { - public: - NativeFontImpl (const std::string &fname, int fontIndex, double ptsize, const FontStyle &style, Color color) - : NativeFont(ptsize, style, color), _path(fname), _fontIndex(fontIndex) {} - - NativeFont* clone (double ptsize, const FontStyle &style, Color color) const { - return new NativeFontProxy(this, ptsize, style, color); - } - - Font* clone (double ds, double sc) const {return new NativeFontProxy(this , sc, *style(), color());} - const Font* uniqueFont () const {return this;} - const char* path () const {return _path.c_str();} - int fontIndex() const {return _fontIndex;} - std::string fontFamily () const; - bool findAndAssignBaseFontMap (); - CharMapID getCharMapID () const {return CharMapID::NONE;} - Character decodeChar (UInt32 c) const; - UInt32 unicode (UInt32 c) const; - - private: - std::string _path; - int _fontIndex; - ToUnicodeMap _toUnicodeMap; ///< maps from char indexes to unicode points -}; - - -class VirtualFontProxy : public VirtualFont { - friend class VirtualFontImpl; - public: - Font* clone (double ds, double ss) const {return new VirtualFontProxy(*this, ds, ss);} - const Font* uniqueFont () const {return _vf;} - std::string name () const {return _vf->name();} - const DVIVector* getDVI (int c) const {return _vf->getDVI(c);} - double designSize () const {return _dsize;} - double scaledSize () const {return _ssize;} - double charWidth (int c) const {return _vf->charWidth(c);} - double charDepth (int c) const {return _vf->charDepth(c);} - double charHeight (int c) const {return _vf->charHeight(c);} - double italicCorr (int c) const {return _vf->italicCorr(c);} - const FontMetrics* getMetrics () const {return _vf->getMetrics();} - const char* path () const {return _vf->path();} - - protected: - VirtualFontProxy (const VirtualFont *font, double ds, double ss) : _vf(font), _dsize(ds), _ssize(ss) {} - VirtualFontProxy (const VirtualFontProxy &proxy, double ds, double ss) : _vf(proxy._vf), _dsize(ds), _ssize(ss) {} - void assignChar (UInt32 c, DVIVector *dvi) {delete dvi;} - - private: - const VirtualFont *_vf; - double _dsize; ///< design size in PS point units - double _ssize; ///< scaled size in PS point units -}; - - -class VirtualFontImpl : public VirtualFont, public TFMFont { - friend class VirtualFont; - public: - ~VirtualFontImpl (); - Font* clone (double ds, double ss) const {return new VirtualFontProxy(this, ds, ss);} - const Font* uniqueFont () const {return this;} - const DVIVector* getDVI (int c) const; - const char* path () const; - - protected: - VirtualFontImpl (std::string name, UInt32 checksum, double dsize, double ssize); - void assignChar (UInt32 c, DVIVector *dvi); - - private: - std::map<UInt32, DVIVector*> _charDefs; ///< dvi subroutines defining the characters -}; - - -struct FontException : public MessageException -{ - FontException (std::string msg) : MessageException(msg) {} -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.hpp new file mode 100644 index 00000000000..3e2f3038a74 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.hpp @@ -0,0 +1,383 @@ +/************************************************************************* +** Font.hpp ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef FONT_HPP +#define FONT_HPP + +#include <map> +#include <memory> +#include <string> +#include <vector> +#include "Character.hpp" +#include "CharMapID.hpp" +#include "Color.hpp" +#include "FontCache.hpp" +#include "FontEncoding.hpp" +#include "FontMap.hpp" +#include "FontMetrics.hpp" +#include "GFGlyphTracer.hpp" +#include "Glyph.hpp" +#include "GraphicsPath.hpp" +#include "MessageException.hpp" +#include "RangeMap.hpp" +#include "ToUnicodeMap.hpp" +#include "VFActions.hpp" +#include "VFReader.hpp" + + +struct FontStyle; + + +struct GlyphMetrics +{ + GlyphMetrics () : wl(0), wr(0), h(0), d(0) {} + GlyphMetrics (double wwl, double wwr, double hh, double dd) : wl(wwl), wr(wwr), h(hh), d(dd) {} + double wl, wr, h, d; +}; + + +/** Abstract base for all font classes. */ +class Font { + public: + virtual ~Font () =default; + virtual Font* clone (double ds, double sc) const =0; + virtual const Font* uniqueFont () const =0; + virtual std::string name () const =0; + virtual double designSize () const =0; + virtual double scaledSize () const =0; + virtual double scaleFactor () const {return scaledSize()/designSize();} + virtual double charWidth (int c) const =0; + virtual double charDepth (int c) const =0; + virtual double charHeight (int c) const =0; + virtual double italicCorr (int c) const =0; + virtual const FontMetrics* getMetrics () const =0; + virtual const char* path () const =0; + virtual const char* filename () const; + virtual const FontEncoding* encoding () const; + virtual bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=0) const =0; + virtual void getGlyphMetrics (int c, bool vertical, GlyphMetrics &metrics) const; + virtual uint32_t unicode (uint32_t c) const; + virtual void tidy () const {} + virtual bool findAndAssignBaseFontMap () {return true;} + virtual bool verticalLayout () const {return getMetrics() ? getMetrics()->verticalLayout() : false;} + virtual bool verifyChecksums () const {return true;} + virtual int fontIndex () const {return 0;} + virtual const FontStyle* style () const {return 0;} + virtual Color color () const {return Color::BLACK;} + virtual const FontMap::Entry* fontMapEntry () const; +}; + + +/** Empty font without any glyphs. Instances of this class are used + * if no physical or virtual font file can be found. + * The metric values returned by the member functions are based on cmr10. */ +class EmptyFont : public Font { + public: + EmptyFont (const std::string &name) : _fontname(name) {} + Font* clone (double ds, double sc) const override {return new EmptyFont(*this);} + const Font* uniqueFont () const override {return this;} + std::string name () const override {return _fontname;} + double designSize () const override {return 10;} // cmr10 design size in pt + double scaledSize () const override {return 10;} // cmr10 scaled size in pt + double charWidth (int c) const override {return 9.164;} // width of cmr10's 'M' in pt + double charHeight (int c) const override {return 6.833;} // height of cmr10's 'M' in pt + double charDepth (int c) const override {return 0;} + double italicCorr (int c) const override {return 0;} + const FontMetrics* getMetrics () const override {return 0;} + const char* path () const override {return 0;} + bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=0) const override {return false;} + + private: + std::string _fontname; +}; + + +/** Interface for all physical fonts. */ +class PhysicalFont : public virtual Font { + public: + enum class Type {MF, OTF, PFB, TTC, TTF, UNKNOWN}; + + static Font* create (const std::string &name, uint32_t checksum, double dsize, double ssize, PhysicalFont::Type type); + static Font* create (const std::string &name, int fontindex, uint32_t checksum, double dsize, double ssize); + virtual Type type () const =0; + virtual bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=0) const override; + virtual bool getExactGlyphBox (int c, BoundingBox &bbox, GFGlyphTracer::Callback *cb=0) const; + virtual bool getExactGlyphBox (int c, GlyphMetrics &metrics, bool vertical, GFGlyphTracer::Callback *cb=0) const; + virtual bool isCIDFont () const; + virtual int hAdvance () const; + virtual std::string familyName () const; + virtual std::string styleName () const; + virtual double hAdvance (int c) const; + virtual double vAdvance (int c) const; + std::string glyphName (int c) const; + virtual int unitsPerEm () const; + virtual double scaledAscent () const; + virtual int ascent () const; + virtual int descent () const; + virtual int traceAllGlyphs (bool includeCached, GFGlyphTracer::Callback *cb=0) const; + virtual int collectCharMapIDs (std::vector<CharMapID> &charmapIDs) const; + virtual CharMapID getCharMapID () const =0; + virtual void setCharMapID (const CharMapID &id) {} + virtual Character decodeChar (uint32_t c) const; + const char* path () const override; + + protected: + bool createGF (std::string &gfname) const; + + public: + static bool EXACT_BBOX; + static bool KEEP_TEMP_FILES; + static const char *CACHE_PATH; ///< path to cache directory (0 if caching is disabled) + static double METAFONT_MAG; ///< magnification factor for Metafont calls + + protected: + static FontCache _cache; +}; + + +/** Interface for all virtual fonts. */ +class VirtualFont : public virtual Font { + friend class FontManager; + public: + typedef std::vector<uint8_t> DVIVector; + + public: + static Font* create (const std::string &name, uint32_t checksum, double dsize, double ssize); + virtual const DVIVector* getDVI (int c) const =0; + bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=0) const override {return false;} + + protected: + virtual void assignChar (uint32_t c, DVIVector &&dvi) =0; +}; + + +class TFMFont : public virtual Font { + public: + TFMFont (const std::string &name, uint32_t checksum, double dsize, double ssize); + const FontMetrics* getMetrics () const override; + std::string name () const override {return _fontname;} + double designSize () const override {return _dsize;} + double scaledSize () const override {return _ssize;} + double charWidth (int c) const override; + double charDepth (int c) const override; + double charHeight (int c) const override; + double italicCorr (int c) const override; + bool verifyChecksums () const override; + + private: + mutable std::unique_ptr<FontMetrics> _metrics; + std::string _fontname; + uint32_t _checksum; ///< cheksum to be compared with TFM checksum + double _dsize; ///< design size in PS point units + double _ssize; ///< scaled size in PS point units +}; + + +class PhysicalFontProxy : public PhysicalFont { + friend class PhysicalFontImpl; + public: + Font* clone (double ds, double sc) const override {return new PhysicalFontProxy(*this, ds, sc);} + const Font* uniqueFont () const override {return _pf;} + std::string name () const override {return _pf->name();} + double designSize () const override {return _dsize;} + double scaledSize () const override {return _ssize;} + double charWidth (int c) const override {return _pf->charWidth(c);} + double charDepth (int c) const override {return _pf->charDepth(c);} + double charHeight (int c) const override {return _pf->charHeight(c);} + double italicCorr (int c) const override {return _pf->italicCorr(c);} + const FontMetrics* getMetrics () const override {return _pf->getMetrics();} + Type type () const override {return _pf->type();} + uint32_t unicode (uint32_t c) const override {return _pf->unicode(c);} + int fontIndex () const override {return _pf->fontIndex();} + const FontStyle* style () const override {return _pf->style();} + const FontMap::Entry* fontMapEntry () const override {return _pf->fontMapEntry();} + const FontEncoding* encoding () const override {return _pf->encoding();} + CharMapID getCharMapID () const override {return _pf->getCharMapID();} + int collectCharMapIDs (std::vector<CharMapID> &charmapIDs) const override {return _pf->collectCharMapIDs(charmapIDs);} + + protected: + PhysicalFontProxy (const PhysicalFont *font, double ds, double ss) : _pf(font), _dsize(ds), _ssize(ss) {} + PhysicalFontProxy (const PhysicalFontProxy &proxy, double ds, double ss) : _pf(proxy._pf), _dsize(ds), _ssize(ss) {} + + private: + const PhysicalFont *_pf; + double _dsize; ///< design size in PS point units + double _ssize; ///< scaled size in PS point units +}; + + +class PhysicalFontImpl : public PhysicalFont, public TFMFont { + friend class PhysicalFont; + public: + ~PhysicalFontImpl(); + Font* clone (double ds, double ss) const override {return new PhysicalFontProxy(this, ds, ss);} + const Font* uniqueFont () const override {return this;} + Type type () const override {return _filetype;} + int fontIndex() const override {return _fontIndex;} + const FontStyle* style () const override {return _fontMapEntry ? &_fontMapEntry->style : 0;} + const FontMap::Entry* fontMapEntry () const override {return _fontMapEntry;} + const FontEncoding* encoding () const override; + uint32_t unicode (uint32_t c) const override; + bool findAndAssignBaseFontMap () override; + void tidy () const override; + CharMapID getCharMapID () const override {return _charmapID;} + + protected: + PhysicalFontImpl (const std::string &name, int fontindex, uint32_t checksum, double dsize, double ssize, PhysicalFont::Type type); + + private: + Type _filetype; + int _fontIndex; + const FontMap::Entry *_fontMapEntry; + FontEncodingPair _encodingPair; + CharMapID _charmapID; ///< ID of the font's charmap to use + const RangeMap *_localCharMap; +}; + + +class NativeFont : public PhysicalFont { + public: + virtual NativeFont* clone (double ptsize, const FontStyle &style, Color color) const =0; + virtual Font* clone (double ds, double sc) const override =0; + std::string name () const override; + Type type () const override; + double designSize () const override {return _ptsize;} + double scaledSize () const override {return _ptsize;} + double charWidth (int c) const override; + double charDepth (int c) const override; + double charHeight (int c) const override; + double italicCorr (int c) const override {return 0;} + const FontMetrics* getMetrics () const override {return 0;} + const FontStyle* style () const override {return &_style;} + Color color () const override {return _color;} + const FontMap::Entry* fontMapEntry () const override {return 0;} + static std::string uniqueName (const std::string &path, const FontStyle &style); + + protected: + NativeFont (double ptsize, const FontStyle &style, Color color) : _ptsize(ptsize), _style(style), _color(color) {} + + private: + double _ptsize; ///< font size in PS point units + FontStyle _style; + Color _color; +}; + + +class NativeFontProxy : public NativeFont { + friend class NativeFontImpl; + public: + NativeFont* clone (double ptsize, const FontStyle &style, Color color) const override { + return new NativeFontProxy(this, ptsize, style, color); + } + + Font* clone (double ds, double sc) const override {return new NativeFontProxy(this , sc, *style(), color());} + const Font* uniqueFont () const override {return _nfont;} + const char* path () const override {return _nfont->path();} + int fontIndex () const override {return _nfont->fontIndex();} + Character decodeChar (uint32_t c) const override {return _nfont->decodeChar(c);} + uint32_t unicode (uint32_t c) const override {return _nfont->unicode(c);} + CharMapID getCharMapID () const override {return _nfont->getCharMapID();} + + protected: + NativeFontProxy (const NativeFont *nfont, double ptsize, const FontStyle &style, Color color) + : NativeFont(ptsize, style, color), _nfont(nfont) {} + + private: + const NativeFont *_nfont; +}; + + +class NativeFontImpl : public NativeFont { + public: + NativeFontImpl (const std::string &fname, int fontIndex, double ptsize, const FontStyle &style, Color color) + : NativeFont(ptsize, style, color), _path(fname), _fontIndex(fontIndex) {} + + NativeFont* clone (double ptsize, const FontStyle &style, Color color) const override { + return new NativeFontProxy(this, ptsize, style, color); + } + + Font* clone (double ds, double sc) const override {return new NativeFontProxy(this , sc, *style(), color());} + const Font* uniqueFont () const override {return this;} + const char* path () const override {return _path.c_str();} + int fontIndex() const override {return _fontIndex;} + std::string fontFamily () const; + bool findAndAssignBaseFontMap () override; + CharMapID getCharMapID () const override {return CharMapID::NONE;} + Character decodeChar (uint32_t c) const override; + uint32_t unicode (uint32_t c) const override; + + private: + std::string _path; + int _fontIndex; + ToUnicodeMap _toUnicodeMap; ///< maps from char indexes to unicode points +}; + + +class VirtualFontProxy : public VirtualFont { + friend class VirtualFontImpl; + public: + Font* clone (double ds, double ss) const override {return new VirtualFontProxy(*this, ds, ss);} + const Font* uniqueFont () const override {return _vf;} + std::string name () const override {return _vf->name();} + const DVIVector* getDVI (int c) const override {return _vf->getDVI(c);} + double designSize () const override {return _dsize;} + double scaledSize () const override {return _ssize;} + double charWidth (int c) const override {return _vf->charWidth(c);} + double charDepth (int c) const override {return _vf->charDepth(c);} + double charHeight (int c) const override {return _vf->charHeight(c);} + double italicCorr (int c) const override {return _vf->italicCorr(c);} + const FontMetrics* getMetrics () const override {return _vf->getMetrics();} + const char* path () const override {return _vf->path();} + + protected: + VirtualFontProxy (const VirtualFont *font, double ds, double ss) : _vf(font), _dsize(ds), _ssize(ss) {} + VirtualFontProxy (const VirtualFontProxy &proxy, double ds, double ss) : _vf(proxy._vf), _dsize(ds), _ssize(ss) {} + void assignChar (uint32_t c, DVIVector &&dvi) override {} + + private: + const VirtualFont *_vf; + double _dsize; ///< design size in PS point units + double _ssize; ///< scaled size in PS point units +}; + + +class VirtualFontImpl : public VirtualFont, public TFMFont { + friend class VirtualFont; + public: + Font* clone (double ds, double ss) const override {return new VirtualFontProxy(this, ds, ss);} + const Font* uniqueFont () const override {return this;} + const DVIVector* getDVI (int c) const override; + const char* path () const override; + + protected: + VirtualFontImpl (const std::string &name, uint32_t checksum, double dsize, double ssize); + void assignChar (uint32_t c, DVIVector &&dvi) override; + + private: + std::map<uint32_t, DVIVector> _charDefs; ///< dvi subroutines defining the characters +}; + + +struct FontException : public MessageException +{ + FontException (const std::string &msg) : MessageException(msg) {} +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.cpp index 30e5043b58e..85114471946 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.cpp @@ -2,7 +2,7 @@ ** FontCache.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -25,23 +25,22 @@ #include <fstream> #include <iomanip> #include <sstream> -#include "CRC32.h" -#include "FileSystem.h" -#include "FontCache.h" -#include "Glyph.h" -#include "Pair.h" -#include "StreamReader.h" -#include "StreamWriter.h" -#include "types.h" +#include "CRC32.hpp" +#include "FileSystem.hpp" +#include "FontCache.hpp" +#include "Glyph.hpp" +#include "Pair.hpp" +#include "StreamReader.hpp" +#include "StreamWriter.hpp" using namespace std; -const UInt8 FontCache::FORMAT_VERSION = 5; +const uint8_t FontCache::FORMAT_VERSION = 5; static Pair32 read_pair (int bytes, StreamReader &sr) { - Int32 x = sr.readSigned(bytes); - Int32 y = sr.readSigned(bytes); + int32_t x = sr.readSigned(bytes); + int32_t y = sr.readSigned(bytes); return Pair32(x, y); } @@ -107,8 +106,8 @@ bool FontCache::write (const char* dir) const { /** Returns the minimal number of bytes needed to store the given value. */ -static int max_int_size (Int32 value) { - Int32 limit = 0x7f; +static int max_int_size (int32_t value) { + int32_t limit = 0x7f; for (int i=1; i <= 4; i++) { if ((value < 0 && -value <= limit+1) || (value >= 0 && value <= limit)) return i; @@ -120,7 +119,7 @@ static int max_int_size (Int32 value) { /** Returns the minimal number of bytes needed to store the biggest * pair component of the given vector. */ -static int max_int_size (const Pair<Int32> *pairs, size_t n) { +static int max_int_size (const Pair<int32_t> *pairs, size_t n) { int ret=0; for (size_t i=0; i < n; i++) { ret = max(ret, max_int_size(pairs[i].x())); @@ -147,7 +146,7 @@ bool FontCache::write (const char *fontname, ostream &os) const { struct WriteActions : Glyph::Actions { WriteActions (StreamWriter &sw, CRC32 &crc32) : _sw(sw), _crc32(crc32) {} - void draw (char cmd, const Glyph::Point *points, int n) { + void draw (char cmd, const Glyph::Point *points, int n) override { int bytes = max_int_size(points, n); int cmdchar = (bytes << 5) | (cmd - 'A'); _sw.writeUnsigned(cmdchar, 1, _crc32); @@ -164,9 +163,9 @@ bool FontCache::write (const char *fontname, ostream &os) const { sw.writeUnsigned(0, 4); // space for checksum sw.writeString(fontname, crc32, true); sw.writeUnsigned(_glyphs.size(), 4, crc32); - FORALL(_glyphs, GlyphMap::const_iterator, it) { - const Glyph &glyph = it->second; - sw.writeUnsigned(it->first, 4, crc32); + for (const auto &charglyphpair : _glyphs) { + const Glyph &glyph = charglyphpair.second; + sw.writeUnsigned(charglyphpair.first, 4, crc32); sw.writeUnsigned(glyph.size(), 2, crc32); glyph.iterate(actions, false); } @@ -212,7 +211,7 @@ bool FontCache::read (const char *fontname, istream &is) { if (sr.readUnsigned(1, crc32) != FORMAT_VERSION) return false; - UInt32 crc32_cmp = sr.readUnsigned(4); + uint32_t crc32_cmp = sr.readUnsigned(4); crc32.update(is); if (crc32.get() != crc32_cmp) return false; @@ -224,14 +223,14 @@ bool FontCache::read (const char *fontname, istream &is) { if (fname != fontname) return false; - UInt32 num_glyphs = sr.readUnsigned(4); + uint32_t num_glyphs = sr.readUnsigned(4); while (num_glyphs-- > 0) { - UInt32 c = sr.readUnsigned(4); // character code - UInt16 s = sr.readUnsigned(2); // number of path commands + uint32_t c = sr.readUnsigned(4); // character code + uint16_t s = sr.readUnsigned(2); // number of path commands Glyph &glyph = _glyphs[c]; while (s-- > 0) { - UInt8 cmdval = sr.readUnsigned(1); - UInt8 cmdchar = (cmdval & 0x1f) + 'A'; + uint8_t cmdval = sr.readUnsigned(1); + uint8_t cmdchar = (cmdval & 0x1f) + 'A'; int bytes = cmdval >> 5; switch (cmdchar) { case 'C': { @@ -274,15 +273,15 @@ bool FontCache::fontinfo (const char *dirname, vector<FontInfo> &infos, vector<s if (dirname) { vector<string> fnames; FileSystem::collect(dirname, fnames); - FORALL(fnames, vector<string>::iterator, it) { - if ((*it)[0] == 'f' && it->length() > 5 && it->substr(it->length()-4) == ".fgd") { + for (const string &fname : fnames) { + if (fname[0] == 'f' && fname.length() > 5 && fname.substr(fname.length()-4) == ".fgd") { FontInfo info; - string path = string(dirname)+"/"+(it->substr(1)); + string path = string(dirname)+"/"+(fname.substr(1)); ifstream ifs(path.c_str(), ios::binary); if (fontinfo(ifs, info)) - infos.push_back(info); + infos.emplace_back(move(info)); else - invalid.push_back(it->substr(1)); + invalid.emplace_back(fname.substr(1)); } } } @@ -316,12 +315,12 @@ bool FontCache::fontinfo (std::istream &is, FontInfo &info) { info.name = sr.readString(); info.numchars = sr.readUnsigned(4); - for (UInt32 i=0; i < info.numchars; i++) { + for (uint32_t i=0; i < info.numchars; i++) { sr.readUnsigned(4); // character code - UInt16 s = sr.readUnsigned(2); // number of path commands + uint16_t s = sr.readUnsigned(2); // number of path commands while (s-- > 0) { - UInt8 cmdval = sr.readUnsigned(1); - UInt8 cmdchar = (cmdval & 0x1f) + 'A'; + uint8_t cmdval = sr.readUnsigned(1); + uint8_t cmdchar = (cmdval & 0x1f) + 'A'; int bytes = cmdval >> 5; int bc = 0; switch (cmdchar) { @@ -361,29 +360,27 @@ void FontCache::fontinfo (const char *dirname, ostream &os, bool purge) { ios::fmtflags osflags(os.flags()); vector<FontInfo> infos; vector<string> invalid_files; - if (fontinfo(dirname, infos, invalid_files)) { + if (!fontinfo(dirname, infos, invalid_files)) + os << "cache is empty\n"; + else { os << "cache format version " << infos[0].version << endl; - typedef map<string,FontInfo*> SortMap; - SortMap sortmap; - FORALL(infos, vector<FontInfo>::iterator, it) - sortmap[it->name] = &(*it); - - FORALL(sortmap, SortMap::iterator, it) { + map<string, const FontInfo*> sortmap; + for (const FontInfo &info : infos) + sortmap[info.name] = &info; + for (const auto &strinfopair : sortmap) { os << dec << setfill(' ') << left - << setw(10) << left << it->second->name - << setw(5) << right << it->second->numchars << " glyph" << (it->second->numchars == 1 ? ' ':'s') - << setw(10) << right << it->second->numcmds << " cmd" << (it->second->numcmds == 1 ? ' ':'s') - << setw(12) << right << it->second->numbytes << " byte" << (it->second->numbytes == 1 ? ' ':'s') - << setw(6) << "crc:" << setw(8) << hex << right << setfill('0') << it->second->checksum + << setw(10) << left << strinfopair.second->name + << setw(5) << right << strinfopair.second->numchars << " glyph" << (strinfopair.second->numchars == 1 ? ' ':'s') + << setw(10) << right << strinfopair.second->numcmds << " cmd" << (strinfopair.second->numcmds == 1 ? ' ':'s') + << setw(12) << right << strinfopair.second->numbytes << " byte" << (strinfopair.second->numbytes == 1 ? ' ':'s') + << setw(6) << "crc:" << setw(8) << hex << right << setfill('0') << strinfopair.second->checksum << endl; } } - else - os << "cache is empty\n"; - FORALL(invalid_files, vector<string>::iterator, it) { - string path=string(dirname)+"/"+(*it); + for (const string &str : invalid_files) { + string path=string(dirname)+"/"+str; if (FileSystem::remove(path)) - os << "invalid cache file " << (*it) << " removed\n"; + os << "invalid cache file " << str << " removed\n"; } os.flags(osflags); // restore format flags } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.hpp index 3fea7db79af..f58997ae036 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** FontCache.h ** +** FontCache.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,13 +18,12 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_FONTCACHE_H -#define DVISVGM_FONTCACHE_H +#ifndef FONTCACHE_HPP +#define FONTCACHE_HPP #include <string> #include <map> -#include "types.h" -#include "Glyph.h" +#include "Glyph.hpp" class FontCache @@ -34,12 +33,12 @@ class FontCache public: struct FontInfo { - std::string name; // fontname - UInt16 version; // file format version - UInt32 checksum; // CRC32 checksum of file data - UInt32 numchars; // number of characters - UInt32 numbytes; // number of bytes - UInt32 numcmds; // number of path commands + std::string name; // fontname + uint16_t version; // file format version + uint32_t checksum; // CRC32 checksum of file data + uint32_t numchars; // number of characters + uint32_t numbytes; // number of bytes + uint32_t numcmds; // number of path commands }; public: @@ -60,7 +59,7 @@ class FontCache static void fontinfo (const char *dirname, std::ostream &os, bool purge=false); private: - static const UInt8 FORMAT_VERSION; + static const uint8_t FORMAT_VERSION; std::string _fontname; GlyphMap _glyphs; bool _changed; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.cpp index 8c5382d6b9c..886ab0ec6c6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.cpp @@ -2,7 +2,7 @@ ** FontEncoding.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,11 +19,11 @@ *************************************************************************/ #include <config.h> -#include "CMap.h" -#include "CMapManager.h" -#include "EncFile.h" -#include "FileFinder.h" -#include "FontEncoding.h" +#include "CMap.hpp" +#include "CMapManager.hpp" +#include "EncFile.hpp" +#include "FileFinder.hpp" +#include "FontEncoding.hpp" using namespace std; @@ -31,8 +31,8 @@ using namespace std; struct EncodingMap : public map<string, EncFile*> { ~EncodingMap () { - for (EncodingMap::iterator it=begin(); it != end(); ++it) - delete it->second; + for (auto &entry : *this) + delete entry.second; } }; @@ -48,7 +48,7 @@ FontEncoding* FontEncoding::encoding (const string &encname) { EncodingMap::const_iterator it = encmap.find(encname); if (it != encmap.end()) return it->second; - if (FileFinder::lookup(encname + ".enc", false)) { + if (FileFinder::instance().lookup(encname + ".enc", false)) { EncFile *enc = new EncFile(encname); encmap[encname] = enc; return enc; @@ -61,7 +61,7 @@ FontEncoding* FontEncoding::encoding (const string &encname) { ///////////////////////////////////////////////////////////////////////// -Character FontEncodingPair::decode (UInt32 c) const { +Character FontEncodingPair::decode (uint32_t c) const { if (_enc1) { Character chr = _enc1->decode(c); if (_enc2 && chr.type() != Character::NAME) diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.hpp index fe0efc27f55..ea0f15e4beb 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** FontEncoding.h ** +** FontEncoding.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,12 +18,11 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_FONTENCODING_H -#define DVISVGM_FONTENCODING_H +#ifndef FONTENCODING_HPP +#define FONTENCODING_HPP #include <string> -#include "Character.h" -#include "types.h" +#include "Character.hpp" struct CharMapID; @@ -31,8 +30,8 @@ class PhysicalFont; struct FontEncoding { - virtual ~FontEncoding () {} - virtual Character decode (UInt32 c) const =0; + virtual ~FontEncoding () =default; + virtual Character decode (uint32_t c) const =0; virtual bool mapsToCharIndex () const =0; virtual const FontEncoding* findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const {return 0;} static FontEncoding* encoding (const std::string &encname); @@ -51,9 +50,9 @@ class FontEncodingPair : public FontEncoding public: FontEncodingPair (const FontEncoding *enc1) : _enc1(enc1), _enc2(0) {} FontEncodingPair (const FontEncoding *enc1, const FontEncoding *enc2) : _enc1(enc1), _enc2(enc2) {} - Character decode (UInt32 c) const; - bool mapsToCharIndex () const; - const FontEncoding* findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const; + Character decode (uint32_t c) const override; + bool mapsToCharIndex () const override; + const FontEncoding* findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const override; const FontEncoding* enc1 () const {return _enc1;} const FontEncoding* enc2 () const {return _enc2;} void assign (const FontEncoding *enc); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp index 1e446a6b811..61128964655 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp @@ -2,7 +2,7 @@ ** FontEngine.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -26,10 +26,10 @@ #include FT_OUTLINE_H #include FT_TRUETYPE_TABLES_H #include FT_TYPES_H -#include "Font.h" -#include "FontEngine.h" -#include "FontStyle.h" -#include "Message.h" +#include "Font.hpp" +#include "FontEngine.hpp" +#include "FontStyle.hpp" +#include "Message.hpp" using namespace std; @@ -133,7 +133,7 @@ bool FontEngine::setCharMap (const CharMapID &charMapID) { void FontEngine::buildCharMap (RangeMap &charmap) { charmap.clear(); FT_UInt glyph_index; - UInt32 charcode = FT_Get_First_Char(_currentFace, &glyph_index); + uint32_t charcode = FT_Get_First_Char(_currentFace, &glyph_index); while (glyph_index) { charmap.addRange(glyph_index, glyph_index, charcode); charcode = FT_Get_Next_Char(_currentFace, charcode, &glyph_index); @@ -153,9 +153,9 @@ const RangeMap* FontEngine::createCustomToUnicodeMap () { return 0; RangeMap *charmap = new RangeMap; FT_UInt glyph_index; - UInt32 unicode_point = FT_Get_First_Char(_currentFace, &glyph_index); + uint32_t unicode_point = FT_Get_First_Char(_currentFace, &glyph_index); while (glyph_index) { - UInt32 custom_charcode = index_to_source_chrcode.valueAt(glyph_index); + uint32_t custom_charcode = index_to_source_chrcode.valueAt(glyph_index); charmap->addRange(custom_charcode, custom_charcode, unicode_point); unicode_point = FT_Get_Next_Char(_currentFace, unicode_point, &glyph_index); } @@ -179,15 +179,19 @@ int FontEngine::getUnitsPerEM () const { } -/** Returns the ascender of the current font in font units. */ +/** Returns the ascender of the current font in font units. + * The (usually) positive value denotes the maximum height + * (extent above the baseline) of the font. */ int FontEngine::getAscender () const { return _currentFace ? _currentFace->ascender : 0; } -/** Returns the descender of the current font in font units. */ +/** Returns the descender of the current font in font units. + * The (usually) positive value denotes the maximum depth + * (extent below the baseline) of the font. */ int FontEngine::getDescender () const { - return _currentFace ? _currentFace->descender : 0; + return _currentFace ? -_currentFace->descender : 0; } @@ -299,7 +303,7 @@ int FontEngine::getCharMapIDs (vector<CharMapID> &charmapIDs) const { if (_currentFace) { for (int i=0; i < _currentFace->num_charmaps; i++) { FT_CharMap charmap = _currentFace->charmaps[i]; - charmapIDs.push_back(CharMapID(charmap->platform_id, charmap->encoding_id)); + charmapIDs.emplace_back(CharMapID(charmap->platform_id, charmap->encoding_id)); } } return charmapIDs.size(); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.hpp index 499c0c7450a..a2ec3947c2b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** FontEngine.h ** +** FontEngine.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,8 +18,8 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_FONTENGINE_H -#define DVISVGM_FONTENGINE_H +#ifndef FONTENGINE_HPP +#define FONTENGINE_HPP #include <ft2build.h> #include FT_FREETYPE_H @@ -27,11 +27,10 @@ #include <map> #include <string> #include <vector> -#include "Character.h" -#include "CharMapID.h" -#include "Glyph.h" -#include "RangeMap.h" -#include "types.h" +#include "Character.hpp" +#include "CharMapID.hpp" +#include "Glyph.hpp" +#include "RangeMap.hpp" class Font; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.cpp index 546d5ca646d..885a596b7cd 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.cpp @@ -2,7 +2,7 @@ ** FontManager.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -23,22 +23,16 @@ #include <cstdlib> #include <fstream> #include <set> -#include "CMap.h" -#include "Font.h" -#include "FontManager.h" -#include "FileFinder.h" -#include "FileSystem.h" -#include "Message.h" +#include "CMap.hpp" +#include "Font.hpp" +#include "FontManager.hpp" +#include "FileFinder.hpp" +#include "FileSystem.hpp" +#include "Message.hpp" using namespace std; -FontManager::~FontManager () { - FORALL(_fonts, vector<Font*>::iterator, i) - delete *i; -} - - /** Returns the singleton instance */ FontManager& FontManager::instance () { static FontManager fm; @@ -51,14 +45,14 @@ FontManager& FontManager::instance () { * @return non-negative font ID if font was found, -1 otherwise */ int FontManager::fontID (int n) const { if (_vfStack.empty()) { - Num2IdMap::const_iterator it = _num2id.find(n); + auto it = _num2id.find(n); return (it == _num2id.end()) ? -1 : it->second; } VfNum2IdMap::const_iterator vit = _vfnum2id.find(_vfStack.top()); if (vit == _vfnum2id.end()) return -1; const Num2IdMap &num2id = vit->second; - Num2IdMap::const_iterator it = num2id.find(n); + auto it = num2id.find(n); return (it == num2id.end()) ? -1 : it->second; } @@ -70,7 +64,7 @@ int FontManager::fontID (int n) const { * @return non-negative font ID if font was found, -1 otherwise */ int FontManager::fontID (const Font *font) const { for (size_t i=0; i < _fonts.size(); i++) - if (_fonts[i] == font) + if (_fonts[i].get() == font) return i; return -1; } @@ -80,7 +74,7 @@ int FontManager::fontID (const Font *font) const { * @param[in] name name of font to be identified, e.g. cmr10 * @return non-negative font ID if font was found, -1 otherwise */ int FontManager::fontID (const string &name) const { - map<string,int>::const_iterator it = _name2id.find(name); + auto it = _name2id.find(name); if (it == _name2id.end()) return -1; return it->second; @@ -91,18 +85,17 @@ int FontManager::fontnum (int id) const { if (id < 0 || size_t(id) > _fonts.size()) return -1; if (_vfStack.empty()) { - FORALL(_num2id, Num2IdMap::const_iterator, i) - if (i->second == id) - return i->first; + for (const auto &entry : _num2id) + if (entry.second == id) + return entry.first; } else { - VfNum2IdMap::const_iterator it = _vfnum2id.find(_vfStack.top()); + auto it = _vfnum2id.find(_vfStack.top()); if (it == _vfnum2id.end()) return -1; - const Num2IdMap &num2id = it->second; - FORALL(num2id, Num2IdMap::const_iterator, i) - if (i->second == id) - return i->first; + for (const auto &entry : it->second) + if (entry.second == id) + return entry.first; } return -1; } @@ -119,7 +112,7 @@ int FontManager::vfFirstFontNum (const VirtualFont *vf) const { * @return pointer to font if font was found, 0 otherwise */ Font* FontManager::getFont (int n) const { int id = fontID(n); - return (id < 0) ? 0 : _fonts[id]; + return (id < 0) ? 0 : _fonts[id].get(); } @@ -127,14 +120,14 @@ Font* FontManager::getFont (const string &name) const { int id = fontID(name); if (id < 0) return 0; - return _fonts[id]; + return _fonts[id].get(); } Font* FontManager::getFontById (int id) const { if (id < 0 || size_t(id) >= _fonts.size()) return 0; - return _fonts[id]; + return _fonts[id].get(); } @@ -144,23 +137,23 @@ const VirtualFont* FontManager::getVF () const { } -static Font* create_font (const string &filename, const string &fontname, int fontindex, UInt32 checksum, double dsize, double ssize) { +static Font* create_font (const string &filename, const string &fontname, int fontindex, uint32_t checksum, double dsize, double ssize) { string ext; if (const char *dot = strrchr(filename.c_str(), '.')) ext = dot+1; - if (!ext.empty() && FileFinder::lookup(filename)) { + if (!ext.empty() && FileFinder::instance().lookup(filename)) { if (ext == "pfb") - return PhysicalFont::create(fontname, checksum, dsize, ssize, PhysicalFont::PFB); + return PhysicalFont::create(fontname, checksum, dsize, ssize, PhysicalFont::Type::PFB); if (ext == "otf") - return PhysicalFont::create(fontname, checksum, dsize, ssize, PhysicalFont::OTF); + return PhysicalFont::create(fontname, checksum, dsize, ssize, PhysicalFont::Type::OTF); if (ext == "ttf") - return PhysicalFont::create(fontname, checksum, dsize, ssize, PhysicalFont::TTF); + return PhysicalFont::create(fontname, checksum, dsize, ssize, PhysicalFont::Type::TTF); if (ext == "ttc") return PhysicalFont::create(fontname, fontindex, checksum, dsize, ssize); if (ext == "vf") return VirtualFont::create(fontname, checksum, dsize, ssize); if (ext == "mf") - return PhysicalFont::create(fontname, checksum, dsize, ssize, PhysicalFont::MF); + return PhysicalFont::create(fontname, checksum, dsize, ssize, PhysicalFont::Type::MF); } return 0; } @@ -174,17 +167,17 @@ static Font* create_font (const string &filename, const string &fontname, int fo * @param[in] dsize design size in PS point units * @param[in] ssize scaled size in PS point units * @return id of registered font */ -int FontManager::registerFont (UInt32 fontnum, string name, UInt32 checksum, double dsize, double ssize) { +int FontManager::registerFont (uint32_t fontnum, const string &name, uint32_t checksum, double dsize, double ssize) { int id = fontID(fontnum); if (id >= 0) return id; - Font *newfont = 0; + unique_ptr<Font> newfont; const int newid = _fonts.size(); // the new font gets this ID Name2IdMap::iterator it = _name2id.find(name); if (it != _name2id.end()) { // font with same name already registered? - Font *font = _fonts[it->second]; - newfont = font->clone(dsize, ssize); + const auto &font = _fonts[it->second]; + newfont.reset(font->clone(dsize, ssize)); } else { string filename = name; @@ -196,12 +189,12 @@ int FontManager::registerFont (UInt32 fontnum, string name, UInt32 checksum, dou } // try to find font file with the exact given name if (filename.rfind(".") != string::npos) - newfont = create_font(filename, name, fontindex, checksum, dsize, ssize); + newfont.reset(create_font(filename, name, fontindex, checksum, dsize, ssize)); else { // try various font file formats if the given file has no extension const char *exts[] = {"pfb", "otf", "ttc", "ttf", "vf", "mf", 0}; for (const char **p = exts; *p && !newfont; ++p) - newfont = create_font(filename+"."+*p, name, fontindex, checksum, dsize, ssize); + newfont.reset(create_font(filename+"."+*p, name, fontindex, checksum, dsize, ssize)); } if (newfont) { if (!newfont->findAndAssignBaseFontMap()) @@ -211,7 +204,7 @@ int FontManager::registerFont (UInt32 fontnum, string name, UInt32 checksum, dou } else { // create dummy font as a placeholder if the proper font is not available - newfont = new EmptyFont(name); + newfont.reset(new EmptyFont(name)); if (filename.rfind(".") == string::npos) filename += ".mf"; // print warning message about missing font file (only once for each filename) @@ -223,11 +216,11 @@ int FontManager::registerFont (UInt32 fontnum, string name, UInt32 checksum, dou } _name2id[name] = newid; } - _fonts.push_back(newfont); + _fonts.emplace_back(std::move(newfont)); if (_vfStack.empty()) // register font referenced in dvi file? _num2id[fontnum] = newid; else { // register font referenced in vf file - VirtualFont *vf = const_cast<VirtualFont*>(_vfStack.top()); + const VirtualFont *vf = _vfStack.top(); _vfnum2id[vf][fontnum] = newid; if (_vfFirstFontMap.find(vf) == _vfFirstFontMap.end()) // first fontdef of VF? _vfFirstFontMap[vf] = fontnum; @@ -244,7 +237,7 @@ int FontManager::registerFont (UInt32 fontnum, string name, UInt32 checksum, dou * @param[in] style font style parameters * @param[in] color global font color * @return global font id */ -int FontManager::registerFont (UInt32 fontnum, string filename, double ptsize, const FontStyle &style, Color color) { +int FontManager::registerFont (uint32_t fontnum, const string &filename, double ptsize, const FontStyle &style, Color color) { return registerFont(fontnum, filename, 0, ptsize, style, color); } @@ -258,7 +251,7 @@ int FontManager::registerFont (UInt32 fontnum, string filename, double ptsize, c * @param[in] style font style parameters * @param[in] color global font color * @return global font id */ -int FontManager::registerFont (UInt32 fontnum, string filename, int fontIndex, double ptsize, const FontStyle &style, Color color) { +int FontManager::registerFont (uint32_t fontnum, string filename, int fontIndex, double ptsize, const FontStyle &style, Color color) { int id = fontID(fontnum); if (id >= 0) return id; @@ -267,23 +260,23 @@ int FontManager::registerFont (UInt32 fontnum, string filename, int fontIndex, d filename = filename.substr(1, filename.size()-2); string fontname = NativeFont::uniqueName(filename, style); const char *path = filename.c_str(); - Font *newfont=0; + unique_ptr<Font> newfont; const int newid = _fonts.size(); // the new font gets this ID Name2IdMap::iterator it = _name2id.find(fontname); if (it != _name2id.end()) { // font with same name already registered? - if (NativeFont *font = dynamic_cast<NativeFont*>(_fonts[it->second])) - newfont = font->clone(ptsize, style, color); + if (NativeFont *font = dynamic_cast<NativeFont*>(_fonts[it->second].get())) + newfont.reset(font->clone(ptsize, style, color)); } else { if (!FileSystem::exists(path)) - path = FileFinder::lookup(filename, false); + path = FileFinder::instance().lookup(filename, false); if (path) { - newfont = new NativeFontImpl(path, fontIndex, ptsize, style, color); + newfont.reset(new NativeFontImpl(path, fontIndex, ptsize, style, color)); newfont->findAndAssignBaseFontMap(); } if (!newfont) { // create dummy font as a placeholder if the proper font is not available - newfont = new EmptyFont(filename); + newfont.reset(new EmptyFont(filename)); // print warning message about missing font file (only once for each filename) static set<string> missing_fonts; if (missing_fonts.find(filename) == missing_fonts.end()) { @@ -293,7 +286,7 @@ int FontManager::registerFont (UInt32 fontnum, string filename, int fontIndex, d } _name2id[fontname] = newid; } - _fonts.push_back(newfont); + _fonts.emplace_back(std::move(newfont)); _num2id[fontnum] = newid; return newid; } @@ -317,10 +310,10 @@ void FontManager::leaveVF () { /** Assigns a sequence of DVI commands to a char code. * @param[in] c character code - * @param[in] dvi points to vector with DVI commands */ -void FontManager::assignVfChar (int c, vector<UInt8> *dvi) { - if (!_vfStack.empty() && dvi) - _vfStack.top()->assignChar(c, dvi); + * @param[in] dvi DVI commands that describe character c */ +void FontManager::assignVFChar (int c, vector<uint8_t> &&dvi) { + if (!_vfStack.empty()) + _vfStack.top()->assignChar(c, std::move(dvi)); } @@ -328,8 +321,8 @@ ostream& FontManager::write (ostream &os, Font *font, int level) { #if 0 if (font) { int id = -1; - for (int i=0; i < fonts.size() && id < 0; i++) - if (fonts[i] == font) + for (int i=0; i < _fonts.size() && id < 0; i++) + if (_fonts[i] == font) id = i; VirtualFont *vf = dynamic_cast<VirtualFont*>(font); @@ -343,20 +336,19 @@ ostream& FontManager::write (ostream &os, Font *font, int level) { if (vf) { enterVF(vf); - const Num2IdMap &num2id = vfnum2id.find(vf)->second; - FORALL(num2id, Num2IdMap::const_iterator, i) { - Font *font = fonts[i->second]; + const Num2IdMap &num2id = _vfnum2id.find(vf)->second; + for (const auto &entry : num2id) { + Font *font = _fonts[entry.second]; write(os, font, level+1); } leaveVF(); } } else { - for (int i=0; i < fonts.size(); i++) - write(os, fonts[i], level); + for (int i=0; i < _fonts.size(); i++) + write(os, _fonts[i], level); os << endl; } #endif return os; } - diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.hpp index 7e249a9b9da..ade32bec26c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** FontManager.h ** +** FontManager.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,23 +18,23 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_FONTMANAGER_H -#define DVISVGM_FONTMANAGER_H +#ifndef FONTMANAGER_HPP +#define FONTMANAGER_HPP #include <map> +#include <memory> #include <ostream> #include <set> #include <string> #include <stack> #include <vector> -#include "Color.h" -#include "FontStyle.h" -#include "types.h" +#include "Color.hpp" +#include "FontStyle.hpp" -struct FileFinder; +class FileFinder; class Font; -class VirtualFont; +class VirtualFont; /** This class provides methods for easy DVI font handling. * DVI and VF files use local font numbers to reference fonts. For SVG output @@ -43,18 +43,17 @@ class VirtualFont; * appear anywhere in the output. */ class FontManager { - typedef std::map<UInt32,int> Num2IdMap; + typedef std::map<uint32_t,int> Num2IdMap; typedef std::map<std::string,int> Name2IdMap; typedef std::map<const VirtualFont*,Num2IdMap> VfNum2IdMap; - typedef std::map<const VirtualFont*, UInt32> VfFirstFontMap; + typedef std::map<const VirtualFont*, uint32_t> VfFirstFontMap; typedef std::stack<VirtualFont*> VfStack; public: - ~FontManager (); static FontManager& instance (); - int registerFont (UInt32 fontnum, std::string fontname, UInt32 checksum, double dsize, double scale); - int registerFont (UInt32 fontnum, std::string fname, double ptsize, const FontStyle &style, Color color); - int registerFont (UInt32 fontnum, std::string fname, int fontIndex, double ptsize, const FontStyle &style, Color color); + int registerFont (uint32_t fontnum, const std::string &fontname, uint32_t checksum, double dsize, double scale); + int registerFont (uint32_t fontnum, const std::string &fname, double ptsize, const FontStyle &style, Color color); + int registerFont (uint32_t fontnum, std::string fname, int fontIndex, double ptsize, const FontStyle &style, Color color); Font* getFont (int n) const; Font* getFont (const std::string &name) const; Font* getFontById (int id) const; @@ -66,15 +65,14 @@ class FontManager int vfFirstFontNum (const VirtualFont *vf) const; void enterVF (VirtualFont *vf); void leaveVF (); - void assignVfChar (int c, std::vector<UInt8> *dvi); - const std::vector<Font*>& getFonts () const {return _fonts;} + void assignVFChar (int c, std::vector<uint8_t> &&dvi); std::ostream& write (std::ostream &os, Font *font=0, int level=0); protected: - FontManager () {} + FontManager () =default; private: - std::vector<Font*> _fonts; ///< all registered Fonts + std::vector<std::unique_ptr<Font>> _fonts; ///< all registered Fonts Num2IdMap _num2id; ///< DVI font number -> fontID Name2IdMap _name2id; ///< fontname -> fontID VfNum2IdMap _vfnum2id; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.cpp index 0698e71121f..e91d9c7eaa6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.cpp @@ -2,7 +2,7 @@ ** FontMap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,28 +19,22 @@ *************************************************************************/ #include <config.h> +#include <algorithm> #include <cstring> #include <fstream> #include <limits> #include <vector> -#include "CMap.h" -#include "Directory.h" -#include "FileFinder.h" -#include "FontManager.h" -#include "FontMap.h" -#include "MapLine.h" -#include "Message.h" -#include "Subfont.h" +#include "CMap.hpp" +#include "Directory.hpp" +#include "FileFinder.hpp" +#include "FontManager.hpp" +#include "FontMap.hpp" +#include "MapLine.hpp" +#include "Message.hpp" +#include "Subfont.hpp" using namespace std; - -FontMap::~FontMap () { - for (Iterator it=_entries.begin(); it != _entries.end(); ++it) - delete it->second; -} - - /** Returns the singleton instance. */ FontMap& FontMap::instance() { static FontMap fontmap; @@ -86,9 +80,9 @@ bool FontMap::read (const string &fname, FontMap::Mode mode) { bool FontMap::read (const string &fname, char modechar) { Mode mode; switch (modechar) { - case '=': mode = FM_REPLACE; break; - case '-': mode = FM_REMOVE; break; - default : mode = FM_APPEND; + case '=': mode = Mode::REPLACE; break; + case '-': mode = Mode::REMOVE; break; + default : mode = Mode::APPEND; } return read(fname, mode); } @@ -100,9 +94,9 @@ bool FontMap::read (const string &fname, char modechar) { * @return true in case of success */ bool FontMap::apply (const MapLine& mapline, FontMap::Mode mode) { switch (mode) { - case FM_APPEND: + case Mode::APPEND: return append(mapline); - case FM_REMOVE: + case Mode::REMOVE: return remove(mapline); default: return replace(mapline); @@ -117,9 +111,9 @@ bool FontMap::apply (const MapLine& mapline, FontMap::Mode mode) { bool FontMap::apply (const MapLine& mapline, char modechar) { Mode mode; switch (modechar) { - case '=': mode = FM_REPLACE; break; - case '-': mode = FM_REMOVE; break; - default : mode = FM_APPEND; + case '=': mode = Mode::REPLACE; break; + case '-': mode = Mode::REMOVE; break; + default : mode = Mode::APPEND; } return apply(mapline, mode); } @@ -146,7 +140,7 @@ bool FontMap::read (const string &fname_seq) { } if (!fname.empty()) { if (!read(fname, modechar)) { - if (const char *path = FileFinder::lookup(fname, false)) + if (const char *path = FileFinder::instance().lookup(fname, false)) found = found || read(path, modechar); else Message::wstream(true) << "map file " << fname << " not found\n"; @@ -163,7 +157,7 @@ bool FontMap::read (const string &fname_seq) { * @param[in] mapline parsed font data * @return true if data has been appended */ bool FontMap::append (const MapLine &mapline) { - bool ret = false; + bool appended = false; if (!mapline.texname().empty()) { if (!mapline.fontfname().empty() || !mapline.encname().empty()) { vector<Subfont*> subfonts; @@ -171,17 +165,17 @@ bool FontMap::append (const MapLine &mapline) { mapline.sfd()->subfonts(subfonts); else subfonts.push_back(0); - for (size_t i=0; i < subfonts.size(); i++) { - string fontname = mapline.texname()+(subfonts[i] ? subfonts[i]->id() : ""); - Iterator it = _entries.find(fontname); + for (Subfont *subfont : subfonts) { + string fontname = mapline.texname()+(subfont ? subfont->id() : ""); + auto it = _entries.find(fontname); if (it == _entries.end()) { - _entries[fontname] = new Entry(mapline, subfonts[i]); - ret = true; + _entries[fontname].reset(new Entry(mapline, subfont)); + appended = true; } } } } - return ret; + return appended; } @@ -200,13 +194,13 @@ bool FontMap::replace (const MapLine &mapline) { mapline.sfd()->subfonts(subfonts); else subfonts.push_back(0); - for (size_t i=0; i < subfonts.size(); i++) { - string fontname = mapline.texname()+(subfonts[i] ? subfonts[i]->id() : ""); - Iterator it = _entries.find(fontname); + for (Subfont *subfont : subfonts) { + string fontname = mapline.texname()+(subfont ? subfont->id() : ""); + auto it = _entries.find(fontname); if (it == _entries.end()) - _entries[fontname] = new Entry(mapline, subfonts[i]); + _entries[fontname].reset(new Entry(mapline, subfont)); else if (!it->second->locked) - *it->second = Entry(mapline, subfonts[i]); + *it->second = Entry(mapline, subfont); } return true; } @@ -217,29 +211,29 @@ bool FontMap::replace (const MapLine &mapline) { * @param[in] mapline parsed font data * @return true if entry has been removed */ bool FontMap::remove (const MapLine &mapline) { - bool ret = false; + bool removed = false; if (!mapline.texname().empty()) { vector<Subfont*> subfonts; if (mapline.sfd()) mapline.sfd()->subfonts(subfonts); else subfonts.push_back(0); - for (size_t i=0; i < subfonts.size(); i++) { - string fontname = mapline.texname()+(subfonts[i] ? subfonts[i]->id() : ""); - Iterator it = _entries.find(fontname); + for (const Subfont *subfont : subfonts) { + string fontname = mapline.texname()+(subfont ? subfont->id() : ""); + auto it = _entries.find(fontname); if (it != _entries.end() && !it->second->locked) { _entries.erase(it); - ret = true; + removed = true; } } } - return ret; + return removed; } ostream& FontMap::write (ostream &os) const { - for (ConstIterator it=_entries.begin(); it != _entries.end(); ++it) - os << it->first << " -> " << it->second->fontname << " [" << it->second->encname << "]\n"; + for (const auto &entry : _entries) + os << entry.first << " -> " << entry.second->fontname << " [" << entry.second->encname << "]\n"; return os; } @@ -261,17 +255,17 @@ void FontMap::readdir (const string &dirname) { * @param[in] fontname name of font whose mapped name is retrieved * @returns name of mapped font */ const FontMap::Entry* FontMap::lookup (const string &fontname) const { - ConstIterator it = _entries.find(fontname); + auto it = _entries.find(fontname); if (it == _entries.end()) return 0; - return it->second; + return it->second.get(); } /** Sets the lock flag for the given font in order to avoid changing the map data of this font. * @param[in] fontname name of font to be locked */ void FontMap::lockFont (const string& fontname) { - Iterator it = _entries.find(fontname); + auto it = _entries.find(fontname); if (it != _entries.end()) it->second->locked = true; } @@ -283,14 +277,12 @@ void FontMap::clear (bool unlocked_only) { if (!unlocked_only) _entries.clear(); else { - Iterator it=_entries.begin(); + auto it=_entries.begin(); while (it != _entries.end()) { if (it->second->locked) ++it; - else { - delete it->second; - _entries.erase(it++); - } + else + it = _entries.erase(it); } } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.hpp index 4a4c7e0374a..103bb6aa89a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** FontMap.h ** +** FontMap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,13 +18,14 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_FONTMAP_H -#define DVISVGM_FONTMAP_H +#ifndef FONTMAP_HPP +#define FONTMAP_HPP #include <map> +#include <memory> #include <ostream> #include <string> -#include "FontStyle.h" +#include "FontStyle.hpp" struct FontEncoding; @@ -37,6 +38,9 @@ class FontMap struct Entry { Entry (const MapLine &mapline, Subfont *subfont=0); + Entry (const Entry &entry) =delete; + Entry (Entry &&entry) =default; + Entry& operator = (Entry &&entry) =default; std::string fontname; ///< target font name std::string encname; ///< name of font encoding Subfont *subfont; @@ -45,14 +49,9 @@ class FontMap FontStyle style; }; - protected: - typedef std::map<std::string,Entry*>::iterator Iterator; - typedef std::map<std::string,Entry*>::const_iterator ConstIterator; - public: - enum Mode {FM_APPEND, FM_REMOVE, FM_REPLACE}; + enum class Mode {APPEND, REMOVE, REPLACE}; - ~FontMap (); static FontMap& instance (); bool read (const std::string &fname, Mode mode); bool read (const std::string &fname, char modechar); @@ -66,13 +65,13 @@ class FontMap void lockFont (const std::string &fontname); void clear (bool unlocked_only=false); std::ostream& write (std::ostream &os) const; - const Entry* lookup(const std::string &fontname) const; + const Entry* lookup (const std::string &fontname) const; protected: - FontMap () {} + FontMap () =default; private: - std::map<std::string,Entry*> _entries; + std::map<std::string,std::unique_ptr<Entry>> _entries; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.cpp index c50d010802c..375062f7f0a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.cpp @@ -2,7 +2,7 @@ ** FontMetrics.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -20,19 +20,19 @@ #include <config.h> #include <fstream> -#include "FileFinder.h" -#include "FontMetrics.h" -#include "JFM.h" +#include "FileFinder.hpp" +#include "FontMetrics.hpp" +#include "JFM.hpp" using namespace std; FontMetrics* FontMetrics::read (const char *fontname) { - const char *path = FileFinder::lookup(string(fontname) + ".tfm"); + const char *path = FileFinder::instance().lookup(string(fontname) + ".tfm"); ifstream ifs(path, ios::binary); if (!ifs) return 0; - UInt16 id = 256*ifs.get(); + uint16_t id = 256*ifs.get(); id += ifs.get(); if (id == 9 || id == 11) // Japanese font metric file? return new JFM(ifs); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.hpp index 07c4d7e69cb..cdf462a5a20 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** FontMetrics.h ** +** FontMetrics.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,16 +18,15 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_FONTMETRICS_H -#define DVISVGM_FONTMETRICS_H +#ifndef FONTMETRICS_HPP +#define FONTMETRICS_HPP #include <istream> -#include "MessageException.h" -#include "types.h" +#include "MessageException.hpp" struct FontMetrics { - virtual ~FontMetrics () {} + virtual ~FontMetrics () =default; virtual double getDesignSize () const =0; virtual double getCharWidth (int c) const =0; virtual double getCharHeight (int c) const =0; @@ -37,29 +36,33 @@ struct FontMetrics virtual double getSpaceStretch () const =0; virtual double getSpaceShrink () const =0; virtual double getQuad () const =0; + virtual double getAscent () const =0; + virtual double getDescent () const =0; virtual bool verticalLayout () const =0; - virtual UInt32 getChecksum () const =0; - virtual UInt16 firstChar () const =0; - virtual UInt16 lastChar () const =0; + virtual uint32_t getChecksum () const =0; + virtual uint16_t firstChar () const =0; + virtual uint16_t lastChar () const =0; static FontMetrics* read (const char *fontname); }; struct NullFontMetric : public FontMetrics { - double getDesignSize () const {return 1;} - double getCharWidth (int c) const {return 0;} - double getCharHeight (int c) const {return 0;} - double getCharDepth (int c) const {return 0;} - double getItalicCorr (int c) const {return 0;} - double getSpace () const {return 0;} - double getSpaceStretch () const {return 0;} - double getSpaceShrink () const {return 0;} - double getQuad () const {return 0;} - bool verticalLayout () const {return false;} - UInt32 getChecksum () const {return 0;} - UInt16 firstChar () const {return 0;} - UInt16 lastChar () const {return 0;} + double getDesignSize () const override {return 1;} + double getCharWidth (int c) const override {return 0;} + double getCharHeight (int c) const override {return 0;} + double getCharDepth (int c) const override {return 0;} + double getItalicCorr (int c) const override {return 0;} + double getSpace () const override {return 0;} + double getSpaceStretch () const override {return 0;} + double getSpaceShrink () const override {return 0;} + double getQuad () const override {return 0;} + double getAscent () const override {return 0;} + double getDescent () const override {return 0;} + bool verticalLayout () const override {return false;} + uint32_t getChecksum () const override {return 0;} + uint16_t firstChar () const override {return 0;} + uint16_t lastChar () const override {return 0;} }; @@ -68,5 +71,4 @@ struct FontMetricException : public MessageException FontMetricException (const std::string &msg) : MessageException(msg) {} }; - #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.hpp index 4594986a2dc..fc2a952142a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** FontStyle.h ** +** FontStyle.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.cpp new file mode 100644 index 00000000000..86a822db976 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.cpp @@ -0,0 +1,258 @@ +/************************************************************************* +** FontWriter.cpp ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#include <config.h> +#include <algorithm> +#include <array> +#include "FontWriter.hpp" +#include "utility.hpp" + +using namespace std; + +bool FontWriter::AUTOHINT_FONTS = false; + +const array<FontWriter::FontFormatInfo, 4> FontWriter::_formatInfos = {{ + {FontWriter::FontFormat::SVG, "image/svg+xml", "svg", "svg"}, + {FontWriter::FontFormat::TTF, "application/x-font-ttf", "ttf", "truetype"}, + {FontWriter::FontFormat::WOFF, "application/x-font-woff", "woff", "woff"}, + {FontWriter::FontFormat::WOFF2, "application/x-font-woff2", "woff2", "woff2"}, +}}; + + +/** Returns the corresponding FontFormat for a given format name (e.g. "svg", "woff" etc.). */ +FontWriter::FontFormat FontWriter::toFontFormat (string formatstr) { + util::tolower(formatstr); + for (const FontFormatInfo &info : _formatInfos) { + if (formatstr == info.formatstr_short) + return info.format; + } + return FontFormat::UNKNOWN; +} + + +/** Returns the corresponding FontFormatInfo for a given FontFormat. */ +const FontWriter::FontFormatInfo* FontWriter::fontFormatInfo (FontFormat format) { + for (const FontFormatInfo &info : _formatInfos) { + if (format == info.format) + return &info; + } + return nullptr; +} + + +/** Returns the names of all supported font formats. */ +vector<string> FontWriter::supportedFormats () { + vector<string> formats; + for (const FontFormatInfo &info : _formatInfos) + formats.emplace_back(info.formatstr_short); + return formats; +} + + +#ifdef DISABLE_WOFF +// dummy functions used if WOFF support is disabled +FontWriter::FontWriter (const PhysicalFont &font) : _font(font) {} +std::string FontWriter::createFontFile (FontFormat format, const set<int> &charcodes, GFGlyphTracer::Callback *cb) const {return "";} +bool FontWriter::writeCSSFontFace (FontFormat format, const set<int> &charcodes, ostream &os, GFGlyphTracer::Callback *cb) const {return false;} +#else +#include <cmath> +#include <fstream> +#include <iomanip> +#include <sstream> +#include <woff2_enc.h> +#include <file.h> +#include "ffwrapper.h" +#include "Bezier.hpp" +#include "FileSystem.hpp" +#include "Font.hpp" +#include "Glyph.hpp" +#include "utility.hpp" + + +FontWriter::FontWriter (const PhysicalFont &font) : _font(font) { + static bool initialized=false; + if (!initialized) { + ff_init(); + initialized = true; + } +} + + +struct SFDActions : Glyph::Actions { + SFDActions (ostream &os) : _os(os) {} + void draw (char cmd, const Glyph::Point *points, int n) override { + if (cmd == 'Q') { + // convert quadratic Bézier curve to cubic one + DPair p0(_currentPoint.x(), _currentPoint.y()); + DPair p1(points[0].x(), points[0].y()); + DPair p2(points[1].x(), points[1].y()); + Bezier bezier(p0, p1, p2); + for (int i=1; i < 4; i++) + _os << lround(bezier.point(i).x()) << ' ' << lround(bezier.point(i).y()) << ' '; + _os << 'c'; + } + else { + for (int i=0; i < n; i++) + _os << points[i].x() << ' ' << points[i].y() << ' '; + switch (cmd) { + case 'M': _os << 'm'; _startPoint = points[0]; break; + case 'L': _os << 'l'; break; + case 'C': _os << 'c'; break; + case 'Z': _os << _startPoint.x() << ' ' << _startPoint.y() << " l"; _currentPoint = _startPoint; break; + } + } + if (n > 0) + _currentPoint = points[n-1]; + _os << " 0\n"; + } + ostream &_os; + Glyph::Point _startPoint, _currentPoint; +}; + + +/** Creates a Spline Font Database (SFD) file describing the font and its glyphs. + * https://fontforge.github.io/sfdformat.html */ +static void writeSFD (const string &sfdname, const PhysicalFont &font, const set<int> &charcodes, GFGlyphTracer::Callback *cb) { + ofstream sfd(sfdname); + if (!sfd) + throw FontWriterException("failed writing SFD file "+sfdname); + + sfd << + "SplineFontDB: 3.0\n" + "FontName: " << font.name() << '\n'; + + // ensure that the sum of the SFD's Ascent and Descent values equals the font's units per EM + double yext = font.ascent()+font.descent(); + double scale = double(font.unitsPerEm())/(yext != 0 ? yext : fabs(font.ascent())); + sfd << + "Ascent: " << font.ascent()*scale << "\n" + "Descent: " << font.descent()*scale << "\n" + "LayerCount: 2\n" // number of layers must be 2 at least + "Layer: 0 0 \"Back\" 1\n" // layer 0: background layer with cubic splines + "Layer: 1 0 \"Fore\" 0\n" // layer 1: foreground layer with cubic splines + "Encoding: UnicodeFull\n" // character codes can use the full Unicode range + "BeginChars: 1114112 " << charcodes.size() << '\n'; + + double extend = font.style() ? font.style()->extend : 1; + for (int c : charcodes) { + string name = font.glyphName(c); + if (name.empty()) { + // if the font doesn't provide glyph names, use AGL name uFOO + ostringstream oss; + oss << 'u' << hex << uppercase << setw(4) << setfill('0') << c; + name = oss.str(); + } + uint32_t codepoint = font.unicode(c); + sfd << + "StartChar: " << name << "\n" + "Encoding: " << codepoint << ' ' << codepoint << " 0\n" + "Width: " << font.hAdvance(c)*extend << "\n" + "VWidth: " << font.vAdvance(c) << "\n" + "Fore\n" + "SplineSet\n"; + Glyph glyph; + if (font.getGlyph(c, glyph, cb)) { + SFDActions actions(sfd); + glyph.iterate(actions, false); + } + sfd << + "EndSplineSet\n" + "EndChar\n"; + } + sfd.flush(); + sfd.close(); + if (sfd.fail()) + throw FontWriterException("failed writing SFD file "+sfdname); +} + + +/** Creates a font file containing a given set of glyphs mapped to their Unicode points. + * @param[in] format target font format + * @param[in] charcodes character codes of the glyphs to be considered + * @param[in] cb callback object that allows to react to events triggered by the glyph tracer + * @return name of the created font file */ +string FontWriter::createFontFile (FontFormat format, const set<int> &charcodes, GFGlyphTracer::Callback *cb) const { + string tmpdir = FileSystem::tmpdir(); + string sfdname = tmpdir+_font.name()+"-tmp.sfd"; + writeSFD(sfdname, _font, charcodes, cb); + bool ok = false; + string targetname = tmpdir+_font.name()+"-tmp."+fontFormatInfo(format)->formatstr_short; + switch (format) { + case FontFormat::TTF: + ok = ff_sfd_to_ttf(sfdname.c_str(), targetname.c_str(), AUTOHINT_FONTS); + break; + case FontFormat::WOFF: + ok = ff_sfd_to_woff(sfdname.c_str(), targetname.c_str(), AUTOHINT_FONTS); + break; + case FontFormat::WOFF2: { + string ttfname = tmpdir+_font.name()+".ttf"; + if (ff_sfd_to_ttf(sfdname.c_str(), ttfname.c_str(), AUTOHINT_FONTS)) { + string input = woff2::GetFileContent(ttfname); + const uint8_t* input_data = reinterpret_cast<const uint8_t*>(input.data()); + size_t output_size = woff2::MaxWOFF2CompressedSize(input_data, input.size()); + string output(output_size, 0); + uint8_t* output_data = reinterpret_cast<uint8_t*>(&output[0]); + woff2::WOFF2Params params; + if (woff2::ConvertTTFToWOFF2(input_data, input.size(), output_data, &output_size, params)) { + output.resize(output_size); + woff2::SetFileContents(targetname, output.begin(), output.end()); + ok = true; + } + if (!PhysicalFont::KEEP_TEMP_FILES) + FileSystem::remove(ttfname); + } + break; + } + default:; + } + if (!PhysicalFont::KEEP_TEMP_FILES) + FileSystem::remove(sfdname); + if (!ok) + throw FontWriterException("failed writing "+string(fontFormatInfo(format)->formatstr_short)+ " file " + targetname); + return targetname; +} + + +/** Writes a CSS font-face rule to an output stream that references or contains the WOFF/TTF font data. + * @param[in] format target font format + * @param[in] charcodes character codes of the glyphs to be considered + * @param[in] os stream the CSS data is written to + * @param[in] cb callback object that allows to react to events triggered by the glyph tracer + * @return true on success */ +bool FontWriter::writeCSSFontFace (FontFormat format, const set<int> &charcodes, ostream &os, GFGlyphTracer::Callback *cb) const { + if (const FontFormatInfo *info = fontFormatInfo(format)) { + string filename = createFontFile(format, charcodes, cb); + ifstream ifs(filename, ios::binary); + if (ifs) { + os << "@font-face{" + << "font-family:" << _font.name() << ';' + << "src:url(data:" << info->mimetype << ";base64,"; + util::base64_copy(istreambuf_iterator<char>(ifs), istreambuf_iterator<char>(), ostreambuf_iterator<char>(os)); + os << ") format('" << info->formatstr_long << "');}\n"; + ifs.close(); + if (!PhysicalFont::KEEP_TEMP_FILES) + FileSystem::remove(filename); + return true; + } + } + return false; +} + +#endif // !DISABLE_WOFF diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.hpp new file mode 100644 index 00000000000..05995200383 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.hpp @@ -0,0 +1,66 @@ +/************************************************************************* +** FontWriter.hpp ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef FONTWRITER_HPP +#define FONTWRITER_HPP + +#include <ostream> +#include <set> +#include <string> +#include <vector> +#include "GFGlyphTracer.hpp" +#include "MessageException.hpp" + +class PhysicalFont; + +class FontWriter { + public: + enum class FontFormat {UNKNOWN, SVG, TTF, WOFF, WOFF2}; + static bool AUTOHINT_FONTS; + + public: + FontWriter (const PhysicalFont &font); + std::string createFontFile (FontFormat format, const std::set<int> &charcodes, GFGlyphTracer::Callback *cb=0) const; + bool writeCSSFontFace (FontFormat format, const std::set<int> &charcodes, std::ostream &os, GFGlyphTracer::Callback *cb=0) const; + static FontFormat toFontFormat (std::string formatstr); + static std::vector<std::string> supportedFormats (); + + protected: + struct FontFormatInfo { + FontWriter::FontFormat format; + const char *mimetype; + const char *formatstr_short; + const char *formatstr_long; + }; + + static const FontFormatInfo* fontFormatInfo (FontFormat format); + + private: + const PhysicalFont &_font; + static const std::array<FontFormatInfo, 4> _formatInfos; +}; + + +struct FontWriterException : MessageException { + FontWriterException (const std::string &msg) : MessageException(msg) {} +}; + +#endif + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.cpp index 6e70e55327a..79b3d085782 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.cpp @@ -2,7 +2,7 @@ ** GFGlyphTracer.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,7 +19,7 @@ *************************************************************************/ #include <config.h> -#include "GFGlyphTracer.h" +#include "GFGlyphTracer.hpp" using namespace std; @@ -49,7 +49,7 @@ void GFGlyphTracer::reset (string &fname, double upp) { } -bool GFGlyphTracer::executeChar (UInt8 c) { +bool GFGlyphTracer::executeChar (uint8_t c) { if (!_glyph) return false; @@ -86,7 +86,7 @@ void GFGlyphTracer::closePath () { } -void GFGlyphTracer::endChar (UInt32 c) { +void GFGlyphTracer::endChar (uint32_t c) { _glyph->clear(); GFTracer::endChar(c); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.hpp index 99a19dcb6d7..4ccad3fd19e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** GFGlyphTracer.h ** +** GFGlyphTracer.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,23 +18,23 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_GFGLYPHTRACER_H -#define DVISVGM_GFGLYPHTRACER_H +#ifndef GFGLYPHTRACER_HPP +#define GFGLYPHTRACER_HPP #include <fstream> #include <string> -#include "GFTracer.h" -#include "Glyph.h" +#include "GFTracer.hpp" +#include "Glyph.hpp" class GFGlyphTracer : public GFTracer { public: struct Callback { - virtual ~Callback () {} + virtual ~Callback () =default; virtual void setFont (const std::string &fontname) {} - virtual void beginChar (UInt8 c) {} - virtual void endChar (UInt8 c) {} - virtual void emptyChar (UInt8 c) {} + virtual void beginChar (uint8_t c) {} + virtual void endChar (uint8_t c) {} + virtual void emptyChar (uint8_t c) {} }; public: @@ -42,12 +42,12 @@ class GFGlyphTracer : public GFTracer GFGlyphTracer (std::string &fname, double upp, Callback *cb=0); void reset (std::string &fname, double upp); void setCallback (Callback *cb) {_callback = cb;} - bool executeChar (UInt8 c); - void moveTo (double x, double y); - void lineTo (double x, double y); - void curveTo (double c1x, double c1y, double c2x, double c2y, double x, double y); - void closePath (); - void endChar (UInt32 c); + bool executeChar (uint8_t c) override; + void moveTo (double x, double y) override; + void lineTo (double x, double y) override; + void curveTo (double c1x, double c1y, double c2x, double c2y, double x, double y) override; + void closePath () override; + void endChar (uint32_t c) override; void setGlyph (Glyph &glyph) {_glyph = &glyph;} const Glyph& getGlyph () const {return *_glyph;} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.cpp index e44b3548b67..2321ad85d04 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.cpp @@ -2,7 +2,7 @@ ** GFReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -20,11 +20,14 @@ #include <config.h> #include <sstream> -#include "GFReader.h" -#include "SignalHandler.h" +#include "FixWord.hpp" +#include "GFReader.hpp" +#include "Length.hpp" +#include "SignalHandler.hpp" using namespace std; + struct GFCommand { void (GFReader::*method)(int); @@ -32,13 +35,8 @@ struct GFCommand }; -/** Converts a fix point length to double (PS point units) */ -static inline double fix2double (Int32 fix) { - return double(fix)/(1 << 20)*72/72.27; -} - - -static inline double scaled2double (Int32 scaled) { +/** Converts a scaled value to double */ +static inline double scaled2double (int32_t scaled) { return double(scaled)/(1 << 16); } @@ -53,18 +51,18 @@ GFReader::GFReader (istream &is) : _in(is), _insideCharDef(false), _penDown(fals } -UInt32 GFReader::readUnsigned (int bytes) { - UInt32 ret = 0; +uint32_t GFReader::readUnsigned (int bytes) { + uint32_t ret = 0; for (int i=bytes-1; i >= 0 && !_in.eof(); i--) { - UInt32 b = _in.get(); + uint32_t b = _in.get(); ret |= b << (8*i); } return ret; } -Int32 GFReader::readSigned (int bytes) { - Int32 ret = _in.get(); +int32_t GFReader::readSigned (int bytes) { + int32_t ret = _in.get(); if (ret & 128) // negative value? ret |= 0xffffff00; for (int i=bytes-2; i >= 0 && !_in.eof(); i--) @@ -126,12 +124,12 @@ int GFReader::executeCommand () { } -bool GFReader::executeChar (UInt8 c) { +bool GFReader::executeChar (uint8_t c) { _in.clear(); if (_charInfoMap.empty()) executePostamble(); // read character info _in.clear(); - Iterator it = _charInfoMap.find(c); + auto it = _charInfoMap.find(c); if (_in && it != _charInfoMap.end()) { _in.seekg(it->second.location); while (executeCommand() != 69); // execute all commands until eoc is reached @@ -177,31 +175,16 @@ bool GFReader::executePostamble () { _in.seekg(-5, ios::cur); // now on postpost if (_in.get() != 249) throw GFException("invalid GF file"); - UInt32 q = readUnsigned(4); // pointer to begin of postamble + uint32_t q = readUnsigned(4); // pointer to begin of postamble _in.seekg(q); // now on begin of postamble while (executeCommand() != 249); // execute all commands until postpost is reached return true; } -/** Returns the design size of this font in PS point units. */ -double GFReader::getDesignSize () const { - return fix2double(_designSize); -} - -/** Returns the number of horizontal pixels per point. */ -double GFReader::getHPixelsPerPoint () const { - return scaled2double(_hppp)*72/72.27; -} - -/** Returns the number of vertical pixels per point. */ -double GFReader::getVPixelsPerPoint () const { - return scaled2double(_vppp)*72/72.27; -} - /** Returns the width of character c in PS point units */ -double GFReader::getCharWidth (UInt32 c) const { - ConstIterator it = _charInfoMap.find(c%256); +double GFReader::getCharWidth (uint32_t c) const { + auto it = _charInfoMap.find(c%256); return it == _charInfoMap.end() ? 0 : it->second.width*getDesignSize()/(1<<24); } @@ -210,11 +193,11 @@ double GFReader::getCharWidth (UInt32 c) const { /** Reads the preamble. */ void GFReader::cmdPre (int) { - UInt32 i = readUnsigned(1); + uint32_t i = readUnsigned(1); if (i != 131) throw GFException("invalid identification byte in preamble"); else { - UInt32 k = readUnsigned(1); + uint32_t k = readUnsigned(1); string s = readString(k); preamble(s); } @@ -224,10 +207,10 @@ void GFReader::cmdPre (int) { /** Reads the postamble. */ void GFReader::cmdPost (int) { readUnsigned(4); // pointer to byte after final eoc - _designSize = readUnsigned(4); // design size of font in points + _designSize = double(FixWord(readUnsigned(4)))*Length::pt2bp; // design size of font in points _checksum = readUnsigned(4); // checksum - _hppp = readUnsigned(4); // horizontal pixels per point (scaled int) - _vppp = readUnsigned(4); // vertical pixels per point (scaled int) + _hppp = scaled2double(readUnsigned(4))/Length::pt2bp; // horizontal pixels per PS point + _vppp = scaled2double(readUnsigned(4))/Length::pt2bp; // vertical pixels per PS point _in.seekg(16, ios::cur); // skip x and y bounds postamble(); } @@ -236,7 +219,7 @@ void GFReader::cmdPost (int) { /** Reads trailing bytes at end of stream. */ void GFReader::cmdPostPost (int) { readUnsigned(4); // pointer to begin of postamble - UInt32 i = readUnsigned(1); + uint32_t i = readUnsigned(1); if (i != 131) throw GFException("invalid identification byte in postpost"); while (readUnsigned(1) == 223); // skip fill bytes @@ -249,10 +232,10 @@ void GFReader::cmdPostPost (int) { void GFReader::cmdPaint0 (int n) { if (!_insideCharDef) throw GFException("character-related command outside BOC and EOC"); - if (_penDown) // set pixels? + if (_penDown) // set pixels? _bitmap.setBits(_y, _x, n); _x += n; - _penDown = !_penDown; // inverse pen state + _penDown = !_penDown; // invert pen state } @@ -261,7 +244,7 @@ void GFReader::cmdPaint0 (int n) { * the input stream. * @param[in] len size of n in bytes */ void GFReader::cmdPaint (int len) { - UInt32 pixels = readUnsigned(len); + uint32_t pixels = readUnsigned(len); cmdPaint0(pixels); } @@ -286,10 +269,10 @@ void GFReader::cmdBoc (int) { /** Beginning of character (compact format). */ void GFReader::cmdBoc1 (int) { _currentChar = readUnsigned(1); - UInt32 dx = readUnsigned(1); + uint32_t dx = readUnsigned(1); _maxX = readUnsigned(1); _minX = _maxX - dx; - UInt32 dy = readUnsigned(1); + uint32_t dy = readUnsigned(1); _maxY = readUnsigned(1); _minY = _maxY - dy; _x = _minX; @@ -339,14 +322,14 @@ void GFReader::cmdNewRow (int col) { void GFReader::cmdXXX (int len) { - UInt32 n = readUnsigned(len); + uint32_t n = readUnsigned(len); string str = readString(n); special(str); } void GFReader::cmdYYY (int) { - Int32 y = readSigned(4); + int32_t y = readSigned(4); numspecial(y); } @@ -358,22 +341,22 @@ void GFReader::cmdNop (int) { /** Reads character locator (part of postamble) */ void GFReader::cmdCharLoc0 (int) { - UInt8 c = readUnsigned(1); // character code mod 256 - UInt8 dm = readUnsigned(1); // - Int32 w = readSigned(4); // (1<<24)*characterWidth/designSize - Int32 p = readSigned(4); // pointer to begin of (last) character data - Int32 dx = 65536*dm; - Int32 dy = 0; + uint8_t c = readUnsigned(1); // character code mod 256 + uint8_t dm = readUnsigned(1); // + int32_t w = readSigned(4); // (1<<24)*characterWidth/designSize + int32_t p = readSigned(4); // pointer to begin of (last) character data + int32_t dx = 65536*dm; + int32_t dy = 0; _charInfoMap[c] = CharInfo(dx, dy, w, p); } /** Reads character locator (part of postamble) */ void GFReader::cmdCharLoc (int) { - UInt32 c = readUnsigned(1); // character code mod 256 - Int32 dx = readSigned(4); // horizontal escapement (scaled pixel units) - Int32 dy = readSigned(4); // vertical escapement (scaled pixel units) - Int32 w = readSigned(4); // (1<<24)*characterWidth/designSize - Int32 p = readSigned(4); // pointer to begin of (last) character data + uint32_t c = readUnsigned(1); // character code mod 256 + int32_t dx = readSigned(4); // horizontal escapement (scaled pixel units) + int32_t dy = readSigned(4); // vertical escapement (scaled pixel units) + int32_t w = readSigned(4); // (1<<24)*characterWidth/designSize + int32_t p = readSigned(4); // pointer to begin of (last) character data _charInfoMap[c] = CharInfo(dx, dy, w, p); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.hpp index ce8ee53b7a5..6ca0dc3fca1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** GFReader.h ** +** GFReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,15 +18,14 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_GFREADER_H -#define DVISVGM_GFREADER_H +#ifndef GFREADER_HPP +#define GFREADER_HPP #include <istream> #include <map> #include <string> -#include "Bitmap.h" -#include "MessageException.h" -#include "types.h" +#include "Bitmap.hpp" +#include "MessageException.hpp" class CharInfo; @@ -43,38 +42,36 @@ class GFReader struct CharInfo { CharInfo () : dx(0), dy(0), width(0), location(0) {} - CharInfo (Int32 dxx, Int32 dyy, Int32 w, UInt32 p) : dx(dxx), dy(dyy), width(w), location(p) {} + CharInfo (int32_t dxx, int32_t dyy, int32_t w, uint32_t p) : dx(dxx), dy(dyy), width(w), location(p) {} - Int32 dx, dy; - Int32 width; // 2^24 * (true width)/(design size) - UInt32 location; + int32_t dx, dy; + int32_t width; // 2^24 * (true width)/(design size) + uint32_t location; }; - typedef std::map<UInt8,CharInfo>::iterator Iterator; - typedef std::map<UInt8,CharInfo>::const_iterator ConstIterator; public: - GFReader (std::istream &is); - virtual ~GFReader () {} - bool executeChar (UInt8 c); - bool executeAllChars (); + explicit GFReader (std::istream &is); + virtual ~GFReader () =default; + virtual bool executeChar (uint8_t c); + virtual bool executeAllChars (); bool executePreamble (); bool executePostamble (); virtual void preamble (const std::string &str) {} virtual void postamble () {} - virtual void beginChar (UInt32 c) {} - virtual void endChar (UInt32 c) {} - virtual void special (std::string str) {} - virtual void numspecial (Int32 y) {} - const Bitmap& getBitmap () const {return _bitmap;} - double getDesignSize () const; - double getHPixelsPerPoint () const; - double getVPixelsPerPoint () const; - double getCharWidth (UInt32 c) const; - UInt32 getChecksum () const {return _checksum;} + virtual void beginChar (uint32_t c) {} + virtual void endChar (uint32_t c) {} + virtual void special (const std::string &str) {} + virtual void numspecial (int32_t y) {} + const Bitmap& getBitmap () const {return _bitmap;} + double getDesignSize () const {return _designSize;} + double getHPixelsPerPoint () const {return _hppp;} + double getVPixelsPerPoint () const {return _vppp;}; + double getCharWidth (uint32_t c) const; + uint32_t getChecksum () const {return _checksum;} protected: - Int32 readSigned (int bytes); - UInt32 readUnsigned (int bytes); + int32_t readSigned (int bytes); + uint32_t readUnsigned (int bytes); std::string readString (int len); int executeCommand (); std::istream& getInputStream () const {return _in;} @@ -97,15 +94,15 @@ class GFReader private: std::istream &_in; - Int32 _minX, _maxX, _minY, _maxY; - Int32 _x, _y; ///< current pen location (pixel units) - Int32 _currentChar; - Bitmap _bitmap; ///< bitmap of current char - FixWord _designSize; ///< designSize - ScaledInt _hppp, _vppp; ///< horizontal and vertical pixel per point - UInt32 _checksum; - std::map<UInt8,CharInfo> _charInfoMap; - bool _insideCharDef; ///< true if inside a character definition (between BOC and EOC) + int32_t _minX, _maxX, _minY, _maxY; + int32_t _x, _y; ///< current pen location (pixel units) + int32_t _currentChar; + Bitmap _bitmap; ///< bitmap of current char + double _designSize; ///< designSize in PS points + double _hppp, _vppp; ///< horizontal and vertical pixel per point + uint32_t _checksum; + std::map<uint8_t,CharInfo> _charInfoMap; + bool _insideCharDef; ///< true if inside a character definition (between BOC and EOC) bool _penDown; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.cpp index 87518f872c8..66f16f05bff 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.cpp @@ -2,7 +2,7 @@ ** GFTracer.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -21,9 +21,9 @@ #include <config.h> #include <fstream> #include <potracelib.h> -#include "GFTracer.h" -#include "Glyph.h" -#include "Message.h" +#include "GFTracer.hpp" +#include "Glyph.hpp" +#include "Message.hpp" using namespace std; @@ -43,11 +43,11 @@ GFTracer::GFTracer (istream &is, double upp) } -void GFTracer::beginChar (UInt32 c) { +void GFTracer::beginChar (uint32_t c) { } -void GFTracer::endChar (UInt32 c) { +void GFTracer::endChar (uint32_t c) { const Bitmap &bitmap = getBitmap(); if (bitmap.empty()) return; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.hpp index a282e253b81..229ef2593fe 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** GFTracer.h ** +** GFTracer.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,24 +18,24 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_GFTRACER_H -#define DVISVGM_GFTRACER_H +#ifndef GFTRACER_HPP +#define GFTRACER_HPP #include <istream> -#include "GFReader.h" +#include "GFReader.hpp" class GFTracer : public GFReader { public: GFTracer (std::istream &is); GFTracer (std::istream &is, double upp); - virtual ~GFTracer () {} + virtual ~GFTracer () =default; virtual void moveTo (double x, double y) =0; virtual void lineTo (double x, double y) =0; virtual void curveTo (double c1x, double c1y, double c2x, double c2y, double x, double y) =0; virtual void closePath () =0; - void beginChar (UInt32 c); - void endChar (UInt32 c); + void beginChar (uint32_t c) override; + void endChar (uint32_t c) override; protected: void unitsPerPoint(double upp) {_unitsPerPoint = upp;} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp index 2388f737bb2..1798f35a1b5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp @@ -2,7 +2,7 @@ ** Ghostscript.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,7 +19,7 @@ *************************************************************************/ #include <config.h> -#include "Ghostscript.h" +#include "Ghostscript.hpp" #if !defined(DISABLE_GS) #include <cstring> #include <iomanip> @@ -28,7 +28,7 @@ #include <ghostscript/ierrors.h> #else #include "ierrors.h" - #include "FileFinder.h" + #include "FileFinder.hpp" #endif using namespace std; @@ -45,7 +45,7 @@ static string get_path_from_registry () { #ifdef RRF_RT_REG_SZ // RegGetValueA and RRF_RT_REG_SZ may not be defined for some oldish MinGW REGSAM mode = KEY_READ|KEY_QUERY_VALUE; #ifdef KEY_WOW64_64KEY -#ifdef __WIN64__ +#ifdef _WIN64 mode |= KEY_WOW64_64KEY; #else mode |= KEY_WOW64_32KEY; @@ -89,13 +89,13 @@ static string get_libgs (const string &fname) { if (!fname.empty()) return fname; #ifdef MIKTEX -#if defined(__WIN64__) +#if defined(_WIN64) const char *gsdll = "mgsdll64.dll"; #else const char *gsdll = "mgsdll32.dll"; #endif // try to look up the Ghostscript DLL coming with MiKTeX - if (const char *gsdll_path = FileFinder::lookup(gsdll)) + if (const char *gsdll_path = FileFinder::instance().lookup(gsdll)) return gsdll_path; #endif // MIKTEX #if defined(_WIN32) @@ -104,7 +104,7 @@ static string get_libgs (const string &fname) { if (!gsdll_path.empty()) return gsdll_path; #endif -#if defined(__WIN64__) +#if defined(_WIN64) return "gsdll64.dll"; #elif defined(_WIN32) return "gsdll32.dll"; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.hpp index 82522489104..01f4b3abea2 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** Ghostscript.h ** +** Ghostscript.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,8 +18,8 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_GHOSTSCRIPT_H -#define DVISVGM_GHOSTSCRIPT_H +#ifndef GHOSTSCRIPT_HPP +#define GHOSTSCRIPT_HPP #include <config.h> #include <string> @@ -29,7 +29,7 @@ #elif defined(HAVE_LIBGS) #include <ghostscript/iapi.h> #else - #include "DLLoader.h" + #include "DLLoader.hpp" #include "iapi.h" #endif @@ -74,6 +74,7 @@ class Ghostscript public: Ghostscript (); Ghostscript (int argc, const char **argv, void *caller=0); + Ghostscript (const Ghostscript &gs) =delete; ~Ghostscript (); bool init (int argc, const char **argv, void *caller=0); bool available (); @@ -89,7 +90,6 @@ class Ghostscript static std::string LIBGS_NAME; protected: - Ghostscript (const Ghostscript &gs) : _inst(0) {} int init_with_args (int argc, char **argv); int new_instance (void **psinst, void *caller); void delete_instance (); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.hpp index 98eccbf2fe5..cc593a269aa 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** Glyph.h ** +** Glyph.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,11 +18,11 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_GLYPH_H -#define DVISVGM_GLYPH_H +#ifndef GLYPH_HPP +#define GLYPH_HPP -#include "GraphicsPath.h" +#include "GraphicsPath.hpp" -typedef GraphicsPath<Int32> Glyph; +typedef GraphicsPath<int32_t> Glyph; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GlyphTracerMessages.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/GlyphTracerMessages.hpp index 0eeaab478c2..b77a582796b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GlyphTracerMessages.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GlyphTracerMessages.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** GlyphTracerMessages.h ** +** GlyphTracerMessages.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,13 +18,12 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_GLYPHTRACERMESSAGES_H -#define DVISVGM_GLYPHTRACERMESSAGES_H +#ifndef GLYPHTRACERMESSAGES_HPP +#define GLYPHTRACERMESSAGES_HPP #include <sstream> -#include "GFGlyphTracer.h" -#include "Message.h" -#include "types.h" +#include "GFGlyphTracer.hpp" +#include "Message.hpp" class GlyphTracerMessages : public GFGlyphTracer::Callback { @@ -36,17 +35,24 @@ class GlyphTracerMessages : public GFGlyphTracer::Callback Message::mstream() << '\n'; } - void beginChar (UInt8 c) { + void beginChar (uint8_t c) override { if (!_traced) { if (!_fname.empty()) Message::mstream() << '\n'; + // extract font name from file path + std::string fontname = _fname; + size_t pos; + if ((pos = fontname.rfind('/')) != std::string::npos) + fontname = fontname.substr(pos+1); + if ((pos = fontname.rfind('.')) != std::string::npos) + fontname = fontname.substr(0, pos); Message::mstream(false, Message::MC_STATE) - << "tracing glyphs of " << _fname.substr(0, _fname.length()-3) << '\n'; + << "tracing glyphs of " << fontname << '\n'; _traced = true; } } - void endChar (UInt8 c) { + void endChar (uint8_t c) override { std::ostringstream oss; oss << '['; if (isprint(c)) @@ -57,7 +63,7 @@ class GlyphTracerMessages : public GFGlyphTracer::Callback Message::mstream(false, Message::MC_TRACING) << oss.str(); } - void setFont (const std::string &fname) { + void setFont (const std::string &fname) override { if (_sfmsg && fname != _fname) { _fname = fname; _traced = false; @@ -70,5 +76,4 @@ class GlyphTracerMessages : public GFGlyphTracer::Callback bool _traced; ///< true if a glyph of the current font has already been traced? }; - #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicsPath.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicsPath.hpp index 2919b793724..010302a2257 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicsPath.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicsPath.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** GraphicsPath.h ** +** GraphicsPath.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,17 +18,16 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_GRAPHICPATH_H -#define DVISVGM_GRAPHICPATH_H +#ifndef GRAPHICSPATH_HPP +#define GRAPHICSPATH_HPP #include <cctype> -#include <list> #include <ostream> #include <vector> -#include "BoundingBox.h" -#include "Matrix.h" -#include "Pair.h" -#include "XMLString.h" +#include "BoundingBox.hpp" +#include "Matrix.hpp" +#include "Pair.hpp" +#include "XMLString.hpp" template <typename T> @@ -36,11 +35,11 @@ class GraphicsPath { friend class PathClipper; public: - enum WindingRule {WR_EVEN_ODD, WR_NON_ZERO}; + enum class WindingRule {EVEN_ODD, NON_ZERO}; typedef Pair<T> Point; struct Command { - enum Type {MOVETO, LINETO, CONICTO, CUBICTO, CLOSEPATH}; + enum class Type {MOVETO, LINETO, CONICTO, CUBICTO, CLOSEPATH}; Command (Type t) : type(t) {} @@ -61,11 +60,11 @@ class GraphicsPath int numParams () const { switch (type) { - case CLOSEPATH : return 0; - case MOVETO : - case LINETO : return 1; - case CONICTO : return 2; - case CUBICTO : return 3; + case Type::CLOSEPATH : return 0; + case Type::MOVETO : + case Type::LINETO : return 1; + case Type::CONICTO : return 2; + case Type::CUBICTO : return 3; } return 0; } @@ -79,9 +78,8 @@ class GraphicsPath Point params[3]; }; - struct Actions - { - virtual ~Actions () {} + struct Actions { + virtual ~Actions () =default; virtual void moveto (const Point &p) {} virtual void lineto (const Point &p) {} virtual void hlineto (const T &y) {} @@ -96,12 +94,8 @@ class GraphicsPath virtual void finished () {} }; - typedef typename std::vector<Command>::iterator Iterator; - typedef typename std::vector<Command>::const_iterator ConstIterator; - typedef typename std::vector<Command>::const_reverse_iterator ConstRevIterator; - public: - GraphicsPath (WindingRule wr=WR_NON_ZERO) : _windingRule(wr) {} + GraphicsPath (WindingRule wr=WindingRule::NON_ZERO) : _windingRule(wr) {} void setWindingRule (WindingRule wr) {_windingRule = wr;} WindingRule windingRule () const {return _windingRule;} @@ -131,8 +125,8 @@ class GraphicsPath void moveto (const Point &p) { // avoid sequences of several MOVETOs; always use latest - if (_commands.empty() || _commands.back().type != Command::MOVETO) - _commands.push_back(Command(Command::MOVETO, p)); + if (_commands.empty() || _commands.back().type != Command::Type::MOVETO) + _commands.emplace_back(Command(Command::Type::MOVETO, p)); else _commands.back().params[0] = p; } @@ -142,7 +136,7 @@ class GraphicsPath } void lineto (const Point &p) { - _commands.push_back(Command(Command::LINETO, p)); + _commands.emplace_back(Command(Command::Type::LINETO, p)); } void conicto (const T &x1, const T &y1, const T &x2, const T &y2) { @@ -150,7 +144,7 @@ class GraphicsPath } void conicto (const Point &p1, const Point &p2) { - _commands.push_back(Command(Command::CONICTO, p1, p2)); + _commands.emplace_back(Command(Command::Type::CONICTO, p1, p2)); } void cubicto (const T &x1, const T &y1, const T &x2, const T &y2, const T &x3, const T &y3) { @@ -158,14 +152,13 @@ class GraphicsPath } void cubicto (const Point &p1, const Point &p2, const Point &p3) { - _commands.push_back(Command(Command::CUBICTO, p1, p2, p3)); + _commands.emplace_back(Command(Command::Type::CUBICTO, p1, p2, p3)); } void closepath () { - _commands.push_back(Command(Command::CLOSEPATH)); + _commands.emplace_back(Command(Command::Type::CLOSEPATH)); } - const std::vector<Command>& commands () const { return _commands; } @@ -177,16 +170,15 @@ class GraphicsPath * This method detects all open paths and adds the missing closePath statement. */ void closeOpenSubPaths () { Command *prevCommand=0; - FORALL(_commands, Iterator, it) { - if (it->type == Command::MOVETO && prevCommand && prevCommand->type != Command::CLOSEPATH) { + for (auto it=_commands.begin(); it != _commands.end(); ++it) { + if (it->type == Command::Type::MOVETO && prevCommand && prevCommand->type != Command::Type::CLOSEPATH) { prevCommand = &(*it); - it = _commands.insert(it, Command(Command::CLOSEPATH))+1; -// ++it; // skip inserted closePath command in next iteration step + it = _commands.insert(it, Command(Command::Type::CLOSEPATH))+1; } else prevCommand = &(*it); } - if (!_commands.empty() && _commands.back().type != Command::CLOSEPATH) + if (!_commands.empty() && _commands.back().type != Command::Type::CLOSEPATH) closepath(); } @@ -194,15 +186,15 @@ class GraphicsPath /** Removes redundant path commands commands. Currently, it only removes movetos. */ void removeRedundantCommands () { // remove trailing moveto commands - while (!_commands.empty() && _commands.back().type == Command::MOVETO) + while (!_commands.empty() && _commands.back().type == Command::Type::MOVETO) _commands.pop_back(); // resolve intermediate sequences of moveto commands - Iterator it=_commands.begin(); + auto it=_commands.begin(); if (it == _commands.end()) return; - Iterator prev = it++; + auto prev = it++; while (it != _commands.end()) { - if (prev->type != Command::MOVETO || it->type != Command::MOVETO) + if (prev->type != Command::Type::MOVETO || it->type != Command::Type::MOVETO) prev = it++; else { prev = _commands.erase(prev); // remove leading MOVETO and advance 'prev' to 'it' @@ -224,7 +216,7 @@ class GraphicsPath WriteActions (std::ostream &os, bool relative, double sx, double sy, double dx, double dy) : _os(os), _relative(relative), _sx(sx), _sy(sy), _dx(dx), _dy(dy) {} - void draw (char cmd, const Point *points, int n) { + void draw (char cmd, const Point *points, int n) override { if (_relative) cmd = tolower(cmd); _os << cmd; @@ -288,10 +280,10 @@ class GraphicsPath void computeBBox (BoundingBox &bbox) const { struct BBoxActions : Actions { BBoxActions (BoundingBox &bb) : bbox(bb) {} - void moveto (const Point &p) {bbox.embed(p);} - void lineto (const Point &p) {bbox.embed(p);} - void conicto (const Point &p1, const Point &p2) {bbox.embed(p1); bbox.embed(p2);} - void cubicto (const Point &p1, const Point &p2, const Point &p3) {bbox.embed(p1); bbox.embed(p2); bbox.embed(p3);} + void moveto (const Point &p) override {bbox.embed(p);} + void lineto (const Point &p) override {bbox.embed(p);} + void conicto (const Point &p1, const Point &p2) override {bbox.embed(p1); bbox.embed(p2);} + void cubicto (const Point &p1, const Point &p2, const Point &p3) override {bbox.embed(p1); bbox.embed(p2); bbox.embed(p3);} BoundingBox &bbox; } actions(bbox); iterate(actions, false); @@ -304,11 +296,11 @@ class GraphicsPath bool isDot (Point &p) const { struct DotActions : Actions { DotActions () : differs(false) {} - void moveto (const Point &p) {point = p;} - void lineto (const Point &p) {differs = (p != point);} - void conicto (const Point &p1, const Point &p2) {differs = (point != p1 || point != p2);} - void cubicto (const Point &p1, const Point &p2, const Point &p3) {differs = (point != p1 || point != p2 || point != p3);} - bool quit () {return differs;} + void moveto (const Point &p) override {point = p;} + void lineto (const Point &p) override {differs = (p != point);} + void conicto (const Point &p1, const Point &p2) override {differs = (point != p1 || point != p2);} + void cubicto (const Point &p1, const Point &p2, const Point &p3) override {differs = (point != p1 || point != p2 || point != p3);} + bool quit () override {return differs;} Point point; bool differs; } actions; @@ -321,8 +313,8 @@ class GraphicsPath /** Transforms the path according to a given Matrix. * @param[in] matrix Matrix describing the affine transformation */ void transform (const Matrix &matrix) { - FORALL(_commands, Iterator, it) - it->transform(matrix); + for (Command &command : _commands) + command.transform(matrix); } void iterate (Actions &actions, bool optimize) const; @@ -342,19 +334,19 @@ class GraphicsPath * @param[in] optimize if true, shorthand drawing commands (hlineto, vlineto,...) are considered */ template <typename T> void GraphicsPath<T>::iterate (Actions &actions, bool optimize) const { - ConstIterator prev = _commands.end(); // pointer to preceding command + auto prev = _commands.end(); // pointer to preceding command Point fp; // first point of current path Point cp; // current point Point pstore[2]; - for (ConstIterator it=_commands.begin(); it != _commands.end() && !actions.quit(); ++it) { + for (auto it=_commands.begin(); it != _commands.end() && !actions.quit(); ++it) { const Point *params = it->params; switch (it->type) { - case Command::MOVETO: + case Command::Type::MOVETO: actions.moveto(params[0]); actions.draw('M', params, 1); fp = params[0]; break; - case Command::LINETO: + case Command::Type::LINETO: if (optimize) { if (cp.x() == params[0].x()) { actions.vlineto(params[0].y()); @@ -374,8 +366,8 @@ void GraphicsPath<T>::iterate (Actions &actions, bool optimize) const { actions.draw('L', params, 1); } break; - case Command::CONICTO: - if (optimize && prev != _commands.end() && prev->type == Command::CONICTO && params[0] == pstore[1]*T(2)-pstore[0]) { + case Command::Type::CONICTO: + if (optimize && prev != _commands.end() && prev->type == Command::Type::CONICTO && params[0] == pstore[1]*T(2)-pstore[0]) { actions.conicto(params[1]); actions.draw('T', params+1, 1); } @@ -386,9 +378,9 @@ void GraphicsPath<T>::iterate (Actions &actions, bool optimize) const { pstore[0] = params[0]; // store control point and pstore[1] = params[1]; // curve endpoint break; - case Command::CUBICTO: + case Command::Type::CUBICTO: // is first control point reflection of preceding second control point? - if (optimize && prev != _commands.end() && prev->type == Command::CUBICTO && params[0] == pstore[1]*T(2)-pstore[0]) { + if (optimize && prev != _commands.end() && prev->type == Command::Type::CUBICTO && params[0] == pstore[1]*T(2)-pstore[0]) { actions.cubicto(params[1], params[2]); actions.draw('S', params+1, 2); } @@ -399,7 +391,7 @@ void GraphicsPath<T>::iterate (Actions &actions, bool optimize) const { pstore[0] = params[1]; // store second control point and pstore[1] = params[2]; // curve endpoint break; - case Command::CLOSEPATH: + case Command::Type::CLOSEPATH: actions.closepath(); actions.draw('Z', params, 0); cp = fp; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp index a58e08bca5c..e8b11bcb434 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp @@ -2,7 +2,7 @@ ** HtmlSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -21,16 +21,16 @@ #include <config.h> #include <cassert> #include <sstream> -#include "HtmlSpecialHandler.h" -#include "InputReader.h" -#include "Message.h" -#include "SpecialActions.h" -#include "SVGTree.h" +#include "HtmlSpecialHandler.hpp" +#include "InputReader.hpp" +#include "Message.hpp" +#include "SpecialActions.hpp" +#include "SVGTree.hpp" using namespace std; // variable to select the link marker variant (none, underlined, boxed, or colored background) -HtmlSpecialHandler::MarkerType HtmlSpecialHandler::MARKER_TYPE = HtmlSpecialHandler::MT_LINE; +HtmlSpecialHandler::MarkerType HtmlSpecialHandler::MARKER_TYPE = HtmlSpecialHandler::MarkerType::LINE; Color HtmlSpecialHandler::LINK_BGCOLOR; Color HtmlSpecialHandler::LINK_LINECOLOR; bool HtmlSpecialHandler::USE_LINECOLOR = false; @@ -135,7 +135,7 @@ void HtmlSpecialHandler::processHrefAnchor (string uri, SpecialActions &actions) actions.pushContextElement(anchor); actions.bbox("{anchor}", true); // start computing the bounding box of the linked area _depthThreshold = actions.getDVIStackDepth(); - _anchorType = AT_HREF; + _anchorType = AnchorType::HREF; } @@ -146,18 +146,18 @@ void HtmlSpecialHandler::processNameAnchor (const string &name, SpecialActions & NamedAnchors::iterator it = _namedAnchors.find(name); assert(it != _namedAnchors.end()); it->second.pos = actions.getY(); - _anchorType = AT_NAME; + _anchorType = AnchorType::NAME; } /** Handles the closing tag (</a> of the current anchor element. */ void HtmlSpecialHandler::closeAnchor (SpecialActions &actions) { - if (_anchorType == AT_HREF) { + if (_anchorType == AnchorType::HREF) { markLinkedBox(actions); actions.popContextElement(); _depthThreshold = 0; } - _anchorType = AT_NONE; + _anchorType = AnchorType::NONE; } @@ -168,7 +168,7 @@ void HtmlSpecialHandler::closeAnchor (SpecialActions &actions) { void HtmlSpecialHandler::markLinkedBox (SpecialActions &actions) { const BoundingBox &bbox = actions.bbox("{anchor}"); if (bbox.width() > 0 && bbox.height() > 0) { // does the bounding box extend in both dimensions? - if (MARKER_TYPE != MT_NONE) { + if (MARKER_TYPE != MarkerType::NONE) { const double linewidth = min(0.5, bbox.height()/15); XMLElementNode *rect = new XMLElementNode("rect"); double x = bbox.minX(); @@ -176,14 +176,14 @@ void HtmlSpecialHandler::markLinkedBox (SpecialActions &actions) { double w = bbox.width(); double h = linewidth; const Color &linecolor = USE_LINECOLOR ? LINK_LINECOLOR : actions.getColor(); - if (MARKER_TYPE == MT_LINE) + if (MARKER_TYPE == MarkerType::LINE) rect->addAttribute("fill", linecolor.svgColorString()); else { x -= linewidth; y = bbox.minY()-linewidth; w += 2*linewidth; h += bbox.height()+linewidth; - if (MARKER_TYPE == MT_BGCOLOR) { + if (MARKER_TYPE == MarkerType::BGCOLOR) { rect->addAttribute("fill", LINK_BGCOLOR.svgColorString()); if (USE_LINECOLOR) { rect->addAttribute("stroke", linecolor.svgColorString()); @@ -201,7 +201,7 @@ void HtmlSpecialHandler::markLinkedBox (SpecialActions &actions) { rect->addAttribute("width", w); rect->addAttribute("height", h); actions.prependToPage(rect); - if (MARKER_TYPE == MT_BOX || MARKER_TYPE == MT_BGCOLOR) { + if (MARKER_TYPE == MarkerType::BOX || MARKER_TYPE == MarkerType::BGCOLOR) { // slightly enlarge the boxed area x -= linewidth; y -= linewidth; @@ -228,7 +228,7 @@ void HtmlSpecialHandler::markLinkedBox (SpecialActions &actions) { /** This method is called every time the DVI position changes. */ void HtmlSpecialHandler::dviMovedTo (double x, double y, SpecialActions &actions) { - if (_active && _anchorType != AT_NONE) { + if (_active && _anchorType != AnchorType::NONE) { // Start a new box if the current depth of the DVI stack underruns // the initial threshold which indicates a line break. if (actions.getDVIStackDepth() < _depthThreshold) { @@ -244,13 +244,13 @@ void HtmlSpecialHandler::dviEndPage (unsigned pageno, SpecialActions &actions) { if (_active) { // create views for all collected named anchors defined on the recent page const BoundingBox &pagebox = actions.bbox(); - for (NamedAnchors::iterator it=_namedAnchors.begin(); it != _namedAnchors.end(); ++it) { - if (it->second.pageno == pageno && it->second.referenced) { // current anchor referenced? + for (auto &stranchorpair : _namedAnchors) { + if (stranchorpair.second.pageno == pageno && stranchorpair.second.referenced) { // current anchor referenced? ostringstream oss; - oss << pagebox.minX() << ' ' << it->second.pos << ' ' + oss << pagebox.minX() << ' ' << stranchorpair.second.pos << ' ' << pagebox.width() << ' ' << pagebox.height(); XMLElementNode *view = new XMLElementNode("view"); - view->addAttribute("id", "loc"+XMLString(it->second.id)); + view->addAttribute("id", "loc"+XMLString(stranchorpair.second.id)); view->addAttribute("viewBox", oss.str()); actions.appendToDefs(view); } @@ -275,18 +275,18 @@ bool HtmlSpecialHandler::setLinkMarker (const string &marker) { color = marker.substr(seppos+1); } if (type.empty() || type == "none") - MARKER_TYPE = MT_NONE; + MARKER_TYPE = MarkerType::NONE; else if (type == "line") - MARKER_TYPE = MT_LINE; + MARKER_TYPE = MarkerType::LINE; else if (type == "box") - MARKER_TYPE = MT_BOX; + MARKER_TYPE = MarkerType::BOX; else { if (!LINK_BGCOLOR.setPSName(type, false)) return false; - MARKER_TYPE = MT_BGCOLOR; + MARKER_TYPE = MarkerType::BGCOLOR; } USE_LINECOLOR = false; - if (MARKER_TYPE != MT_NONE && !color.empty()) { + if (MARKER_TYPE != MarkerType::NONE && !color.empty()) { if (!LINK_LINECOLOR.setPSName(color, false)) return false; USE_LINECOLOR = true; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.hpp index 6c17f4541ca..6d64a93b879 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** HtmlSpecialHandler.h ** +** HtmlSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,13 +18,13 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_HTMLSPECIALHANDLER_H -#define DVISVGM_HTMLSPECIALHANDLER_H +#ifndef HTMLSPECIALHANDLER_HPP +#define HTMLSPECIALHANDLER_HPP #include <map> #include <string> -#include "Color.h" -#include "SpecialHandler.h" +#include "Color.hpp" +#include "SpecialHandler.hpp" class SpecialActions; @@ -39,16 +39,16 @@ class HtmlSpecialHandler : public SpecialHandler, public DVIEndPageListener, pub bool referenced; ///< true if a reference to this anchor exists }; - enum AnchorType {AT_NONE, AT_HREF, AT_NAME}; + enum class AnchorType {NONE, HREF, NAME}; typedef std::map<std::string, NamedAnchor> NamedAnchors; public: - HtmlSpecialHandler () : _active(false), _anchorType(AT_NONE), _depthThreshold(0) {} - void preprocess (const char *prefix, std::istream &is, SpecialActions &actions); - bool process (const char *prefix, std::istream &is, SpecialActions &actions); - const char* name () const {return "html";} - const char* info () const {return "hyperref specials";} - const char** prefixes () const; + HtmlSpecialHandler () : _active(false), _anchorType(AnchorType::NONE), _depthThreshold(0) {} + void preprocess (const char *prefix, std::istream &is, SpecialActions &actions) override; + bool process (const char *prefix, std::istream &is, SpecialActions &actions) override; + const char* name () const override {return "html";} + const char* info () const override {return "hyperref specials";} + const char** prefixes () const override; static bool setLinkMarker (const std::string &marker); @@ -57,12 +57,12 @@ class HtmlSpecialHandler : public SpecialHandler, public DVIEndPageListener, pub void preprocessNameAnchor (const std::string &name, SpecialActions &actions); void processHrefAnchor (std::string uri, SpecialActions &actions); void processNameAnchor (const std::string &name, SpecialActions &actions); - void dviEndPage (unsigned pageno, SpecialActions &actions); - void dviMovedTo (double x, double y, SpecialActions &actions); + void dviEndPage (unsigned pageno, SpecialActions &actions) override; + void dviMovedTo (double x, double y, SpecialActions &actions) override; void closeAnchor (SpecialActions &actions); void markLinkedBox (SpecialActions &actions); - enum MarkerType {MT_NONE, MT_LINE, MT_BOX, MT_BGCOLOR}; + enum class MarkerType {NONE, LINE, BOX, BGCOLOR}; static MarkerType MARKER_TYPE; ///< selects how to mark linked areas static Color LINK_BGCOLOR; ///< background color if linkmark type == LT_BGCOLOR static Color LINK_LINECOLOR; ///< line color if linkmark type is LM_LINE or LM_BOX diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.cpp index b290c28d628..53d7eeee9d0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.cpp @@ -2,7 +2,7 @@ ** InputBuffer.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -21,13 +21,13 @@ #include <config.h> #include <cmath> #include <cstring> -#include "InputBuffer.h" +#include "InputBuffer.hpp" using namespace std; StreamInputBuffer::StreamInputBuffer (istream &is, size_t bufsize) - : _is(is), _bufsize(bufsize), _buf1(new UInt8[_bufsize]), _buf2(new UInt8[_bufsize]), _bufptr(_buf1) + : _is(is), _bufsize(bufsize), _buf1(new uint8_t[_bufsize]), _buf2(new uint8_t[_bufsize]), _bufptr(_buf1) { _size1 = fillBuffer(_buf1); _size2 = fillBuffer(_buf2); @@ -49,7 +49,7 @@ int StreamInputBuffer::get () { _bufptr = _buf1; _size2 = fillBuffer(_buf2); } - UInt8 c = *_bufptr++; + uint8_t c = *_bufptr++; return c; } @@ -77,7 +77,7 @@ int StreamInputBuffer::peek (size_t n) const { * input stream. * @param[in] buf pointer to character buffer to be filled * @return number of characters read */ -int StreamInputBuffer::fillBuffer (UInt8 *buf) { +int StreamInputBuffer::fillBuffer (uint8_t *buf) { if (_is && !_is.eof()) { _is.read((char*)buf, _bufsize); return _is.gcount(); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp index c6f9d58bb48..2509997d05c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** InputBuffer.h ** +** InputBuffer.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,19 +18,18 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_INPUTBUFFER_H -#define DVISVGM_INPUTBUFFER_H +#ifndef INPUTBUFFER_HPP +#define INPUTBUFFER_HPP #include <algorithm> #include <cstring> #include <istream> #include <string> #include <ostream> -#include "types.h" struct InputBuffer { - virtual ~InputBuffer () {} + virtual ~InputBuffer () =default; virtual int get () =0; virtual int peek () const =0; virtual int peek (size_t n) const =0; @@ -44,24 +43,24 @@ class StreamInputBuffer : public InputBuffer public: StreamInputBuffer (std::istream &is, size_t bufsize=1024); ~StreamInputBuffer (); - int get (); - int peek () const; - int peek (size_t n) const; - bool eof () const {return pos() == _size1 && _size2 == 0;} - void invalidate () {_bufptr = _buf1+_size1; _size2 = 0;} + int get () override; + int peek () const override; + int peek (size_t n) const override; + bool eof () const override {return pos() == _size1 && _size2 == 0;} + void invalidate () override {_bufptr = _buf1+_size1; _size2 = 0;} protected: - int fillBuffer (UInt8 *buf); + int fillBuffer (uint8_t *buf); size_t pos () const {return _bufptr-_buf1;} private: std::istream &_is; const size_t _bufsize; ///< maximal number of bytes each buffer can hold - UInt8 *_buf1; ///< pointer to first buffer - UInt8 *_buf2; ///< pointer to second buffer - size_t _size1; ///< number of bytes in buffer 1 - size_t _size2; ///< number of bytes in buffer 2 - UInt8 *_bufptr; ///< pointer to next byte to read + uint8_t *_buf1; ///< pointer to first buffer + uint8_t *_buf2; ///< pointer to second buffer + size_t _size1; ///< number of bytes in buffer 1 + size_t _size2; ///< number of bytes in buffer 2 + uint8_t *_bufptr; ///< pointer to next byte to read }; @@ -69,11 +68,11 @@ class StringInputBuffer : public InputBuffer { public: StringInputBuffer (const std::string &str) : _str(str), _pos(0) {} - int get () {return _pos < _str.length() ? _str[_pos++] : -1;} - int peek () const {return _pos < _str.length() ? _str[_pos] : -1;} - int peek (size_t n) const {return _pos+n < _str.length() ? _str[_pos+n] : -1;} - bool eof () const {return _pos >= _str.length();} - void invalidate () {_pos = _str.length();} + int get () override {return _pos < _str.length() ? _str[_pos++] : -1;} + int peek () const override {return _pos < _str.length() ? _str[_pos] : -1;} + int peek (size_t n) const override {return _pos+n < _str.length() ? _str[_pos+n] : -1;} + bool eof () const override {return _pos >= _str.length();} + void invalidate () override {_pos = _str.length();} private: const std::string &_str; @@ -86,7 +85,7 @@ class CharInputBuffer : public InputBuffer public: CharInputBuffer (const char *buf, size_t size) : _pos(buf), _size(buf ? size : 0) {} - int get () { + int get () override { if (_size == 0) return -1; else { @@ -101,11 +100,11 @@ class CharInputBuffer : public InputBuffer _size = size; } - void assign (const char *buf) {assign(buf, std::strlen(buf));} - int peek () const {return _size > 0 ? *_pos : -1;} - int peek (size_t n) const {return _size >= n ? _pos[n] : -1;} - bool eof () const {return _size == 0;} - void invalidate () {_size = 0;} + void assign (const char *buf) {assign(buf, std::strlen(buf));} + int peek () const override {return _size > 0 ? *_pos : -1;} + int peek (size_t n) const override {return _size >= n ? _pos[n] : -1;} + bool eof () const override {return _size == 0;} + void invalidate () override {_size = 0;} private: const char *_pos; @@ -117,11 +116,11 @@ class SplittedCharInputBuffer : public InputBuffer { public: SplittedCharInputBuffer (const char *buf1, size_t s1, const char *buf2, size_t s2); - int get (); - int peek () const; - int peek (size_t n) const; - bool eof () const {return _size[_index] == 0;} - void invalidate () {_size[_index] = 0;} + int get () override; + int peek () const override; + int peek (size_t n) const override; + bool eof () const override {return _size[_index] == 0;} + void invalidate () override {_size[_index] = 0;} private: const char *_buf[2]; @@ -134,7 +133,7 @@ class TextStreamInputBuffer : public StreamInputBuffer { public: TextStreamInputBuffer (std::istream &is) : StreamInputBuffer(is), _line(1), _col(1) {} - int get (); + int get () override; int line () const {return _line;} int col () const {return _col;} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp index 46107532f68..66b3981fb18 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp @@ -2,7 +2,7 @@ ** InputReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -22,7 +22,7 @@ #include <cmath> #include <functional> #include <vector> -#include "InputReader.h" +#include "InputReader.hpp" using namespace std; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.hpp index 55eb63702d3..0134f19a7f8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** InputReader.h ** +** InputReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,19 +18,19 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_INPUTREADER_H -#define DVISVGM_INPUTREADER_H +#ifndef INPUTREADER_HPP +#define INPUTREADER_HPP #include <istream> #include <map> #include <string> -#include "InputBuffer.h" +#include "InputBuffer.hpp" class InputReader { public: - virtual ~InputReader() {} + virtual ~InputReader() =default; virtual int get () =0; virtual int peek () const =0; virtual int peek (size_t n) const =0; @@ -63,10 +63,10 @@ class StreamInputReader : public InputReader { public: StreamInputReader (std::istream &is) : _is(is) {} - int get () {return _is.get();} - int peek () const {return _is.peek();} - int peek (size_t n) const; - bool eof () const {return !_is || _is.eof();} + int get () override {return _is.get();} + int peek () const override {return _is.peek();} + int peek (size_t n) const override; + bool eof () const override {return !_is || _is.eof();} private: std::istream &_is; @@ -78,10 +78,10 @@ class BufferInputReader : public InputReader public: BufferInputReader (InputBuffer &ib) : _ib(&ib) {} void assign (InputBuffer &ib) {_ib = &ib;} - int get () {return _ib->get();} - int peek () const {return _ib->peek();} - int peek (size_t n) const {return _ib->peek(n);} - bool eof () const {return _ib->eof();} + int get () override {return _ib->get();} + int peek () const override {return _ib->peek();} + int peek (size_t n) const override {return _ib->peek(n);} + bool eof () const override {return _ib->eof();} private: InputBuffer *_ib; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp index d6f97eb0377..9946e7cc26a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp @@ -2,7 +2,7 @@ ** JFM.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -23,8 +23,8 @@ #include <cstring> #include <fstream> #include <sstream> -#include "JFM.h" -#include "StreamReader.h" +#include "JFM.hpp" +#include "StreamReader.hpp" using namespace std; @@ -32,26 +32,26 @@ using namespace std; JFM::JFM (istream &is) { is.seekg(0); StreamReader reader(is); - UInt16 id = UInt16(reader.readUnsigned(2)); // JFM ID (9 or 11) + uint16_t id = uint16_t(reader.readUnsigned(2)); // JFM ID (9 or 11) if (id != 9 && id != 11) { ostringstream oss; oss << "invalid JFM identifier " << id << " (9 or 11 expected)"; throw FontMetricException(oss.str()); } _vertical = (id == 9); - UInt16 nt = UInt16(reader.readUnsigned(2)); // length of character type table - UInt16 lf = UInt16(reader.readUnsigned(2)); // length of entire file in 4 byte words - UInt16 lh = UInt16(reader.readUnsigned(2)); // length of header in 4 byte words - UInt16 bc = UInt16(reader.readUnsigned(2)); // smallest character code in font - UInt16 ec = UInt16(reader.readUnsigned(2)); // largest character code in font - UInt16 nw = UInt16(reader.readUnsigned(2)); // number of words in width table - UInt16 nh = UInt16(reader.readUnsigned(2)); // number of words in height table - UInt16 nd = UInt16(reader.readUnsigned(2)); // number of words in depth table - UInt16 ni = UInt16(reader.readUnsigned(2)); // number of words in italic corr. table - UInt16 nl = UInt16(reader.readUnsigned(2)); // number of words in glue/kern table - UInt16 nk = UInt16(reader.readUnsigned(2)); // number of words in kern table - UInt16 ng = UInt16(reader.readUnsigned(2)); // number of words in glue table - UInt16 np = UInt16(reader.readUnsigned(2)); // number of font parameter words + uint16_t nt = uint16_t(reader.readUnsigned(2)); // length of character type table + uint16_t lf = uint16_t(reader.readUnsigned(2)); // length of entire file in 4 byte words + uint16_t lh = uint16_t(reader.readUnsigned(2)); // length of header in 4 byte words + uint16_t bc = uint16_t(reader.readUnsigned(2)); // smallest character code in font + uint16_t ec = uint16_t(reader.readUnsigned(2)); // largest character code in font + uint16_t nw = uint16_t(reader.readUnsigned(2)); // number of words in width table + uint16_t nh = uint16_t(reader.readUnsigned(2)); // number of words in height table + uint16_t nd = uint16_t(reader.readUnsigned(2)); // number of words in depth table + uint16_t ni = uint16_t(reader.readUnsigned(2)); // number of words in italic corr. table + uint16_t nl = uint16_t(reader.readUnsigned(2)); // number of words in glue/kern table + uint16_t nk = uint16_t(reader.readUnsigned(2)); // number of words in kern table + uint16_t ng = uint16_t(reader.readUnsigned(2)); // number of words in glue table + uint16_t np = uint16_t(reader.readUnsigned(2)); // number of font parameter words if (7+nt+lh+(ec-bc+1)+nw+nh+nd+ni+nl+nk+ng+np != lf) throw FontMetricException("inconsistent length values"); @@ -67,10 +67,10 @@ JFM::JFM (istream &is) { void JFM::readTables (StreamReader &reader, int nt, int nw, int nh, int nd, int ni) { // determine smallest charcode with chartype > 0 - UInt16 minchar=0xFFFF, maxchar=0; + uint16_t minchar=0xFFFF, maxchar=0; for (int i=0; i < nt; i++) { - UInt16 c = (UInt16)reader.readUnsigned(2); - UInt16 t = (UInt16)reader.readUnsigned(2); + uint16_t c = (uint16_t)reader.readUnsigned(2); + uint16_t t = (uint16_t)reader.readUnsigned(2); if (t > 0) { minchar = min(minchar, c); maxchar = max(maxchar, c); @@ -80,11 +80,11 @@ void JFM::readTables (StreamReader &reader, int nt, int nw, int nh, int nd, int if (minchar <= maxchar) { _minchar = minchar; _charTypeTable.resize(maxchar-minchar+1); - memset(&_charTypeTable[0], 0, nt*sizeof(UInt16)); + memset(&_charTypeTable[0], 0, nt*sizeof(uint16_t)); reader.seek(-nt*4, ios::cur); for (int i=0; i < nt; i++) { - UInt16 c = (UInt16)reader.readUnsigned(2); - UInt16 t = (UInt16)reader.readUnsigned(2); + uint16_t c = (uint16_t)reader.readUnsigned(2); + uint16_t t = (uint16_t)reader.readUnsigned(2); if (c >= minchar) _charTypeTable[c-minchar] = t; } @@ -94,7 +94,7 @@ void JFM::readTables (StreamReader &reader, int nt, int nw, int nh, int nd, int int JFM::charIndex (int c) const { - UInt16 chartype = 0; + uint16_t chartype = 0; if (!_charTypeTable.empty() && c >= _minchar && size_t(c) < _minchar+_charTypeTable.size()) chartype = _charTypeTable[c-_minchar]; return TFM::charIndex(chartype); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.hpp index 0046fad0557..e267b29def3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** JFM.h ** +** JFM.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,29 +18,29 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_JFM_H -#define DVISVGM_JFM_H +#ifndef JFM_HPP +#define JFM_HPP #include <istream> -#include "TFM.h" +#include "TFM.hpp" class JFM : public TFM { public: JFM (std::istream &is); - bool verticalLayout () const {return _vertical;} - UInt16 minChar () const {return _minchar;} - UInt16 maxChar () const {return static_cast<UInt16>(_minchar+_charTypeTable.size()-1);} + bool verticalLayout () const override {return _vertical;} + uint16_t minChar () const {return _minchar;} + uint16_t maxChar () const {return static_cast<uint16_t>(_minchar+_charTypeTable.size()-1);} protected: void readTables (StreamReader &reader, int nt, int nw, int nh, int nd, int ni); - int charIndex (int c) const; + int charIndex (int c) const override; private: - UInt16 _minchar; ///< character code of first entry in character type table - bool _vertical; ///< true if metrics refer to vertical text layout - std::vector<UInt16> _charTypeTable; + uint16_t _minchar; ///< character code of first entry in character type table + bool _vertical; ///< true if metrics refer to vertical text layout + std::vector<uint16_t> _charTypeTable; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.cpp index 8ab8120daab..7b8b84814fd 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.cpp @@ -2,7 +2,7 @@ ** Length.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,21 +19,11 @@ *************************************************************************/ #include <sstream> -#include "InputReader.h" -#include "Length.h" +#include "InputReader.hpp" +#include "Length.hpp" using namespace std; -const double Length::pt2in = 1.0/72.27; -const double Length::pt2bp = pt2in*72; -const double Length::pt2cm = pt2in*2.54; -const double Length::pt2mm = pt2cm*10; -const double Length::pt2pc = 1.0/12; -const double Length::pt2dd = 1157.0/1238; -const double Length::pt2cc = pt2dd/12; -const double Length::pt2sp = 65536.0; - - void Length::set (const string &lenstr) { switch (lenstr.length()) { case 0: @@ -59,19 +49,19 @@ void Length::set (const string &lenstr) { void Length::set (double val, Unit unit) { switch (unit) { - case PT: _pt = val; break; - case BP: _pt = val/pt2bp; break; - case IN: _pt = val/pt2in; break; - case CM: _pt = val/pt2cm; break; - case MM: _pt = val/pt2mm; break; - case PC: _pt = val/pt2pc; break; - case DD: _pt = val/pt2dd; break; - case CC: _pt = val/pt2cc; break; - case SP: _pt = val/pt2sp; break; + case Unit::PT: _pt = val; break; + case Unit::BP: _pt = val/pt2bp; break; + case Unit::IN: _pt = val/pt2in; break; + case Unit::CM: _pt = val/pt2cm; break; + case Unit::MM: _pt = val/pt2mm; break; + case Unit::PC: _pt = val/pt2pc; break; + case Unit::DD: _pt = val/pt2dd; break; + case Unit::CC: _pt = val/pt2cc; break; + case Unit::SP: _pt = val/pt2sp; break; default: // this isn't supposed to happen ostringstream oss; - oss << "invalid length unit: (" << unit << ")"; + oss << "invalid length unit: (" << static_cast<int>(unit) << ")"; throw UnitException(oss.str()); } } @@ -79,19 +69,19 @@ void Length::set (double val, Unit unit) { double Length::get (Unit unit) const { switch (unit) { - case PT: return pt(); - case BP: return bp(); - case IN: return in(); - case CM: return cm(); - case MM: return mm(); - case PC: return pc(); - case DD: return dd(); - case CC: return cc(); - case SP: return sp(); + case Unit::PT: return pt(); + case Unit::BP: return bp(); + case Unit::IN: return in(); + case Unit::CM: return cm(); + case Unit::MM: return mm(); + case Unit::PC: return pc(); + case Unit::DD: return dd(); + case Unit::CC: return cc(); + case Unit::SP: return sp(); } // this isn't supposed to happen ostringstream oss; - oss << "invalid length unit: (" << unit << ")"; + oss << "invalid length unit: (" << static_cast<int>(unit) << ")"; throw UnitException(oss.str()); } @@ -103,20 +93,22 @@ string Length::toString (Unit unit) const { } -#define UNIT(c1, c2) ((c1 << 8)|c2) +static constexpr int unit_id (int c1, int c2) { + return (c1 << 8) | c2; +} Length::Unit Length::stringToUnit (const std::string &unitstr) { if (unitstr.length() == 2) { - switch (UNIT(unitstr[0], unitstr[1])) { - case UNIT('p','t'): return PT; - case UNIT('b','p'): return BP; - case UNIT('i','n'): return IN; - case UNIT('c','m'): return CM; - case UNIT('m','m'): return MM; - case UNIT('p','c'): return PC; - case UNIT('d','d'): return DD; - case UNIT('c','c'): return CC; - case UNIT('s','p'): return SP; + switch (unit_id(unitstr[0], unitstr[1])) { + case unit_id('p','t'): return Unit::PT; + case unit_id('b','p'): return Unit::BP; + case unit_id('i','n'): return Unit::IN; + case unit_id('c','m'): return Unit::CM; + case unit_id('m','m'): return Unit::MM; + case unit_id('p','c'): return Unit::PC; + case unit_id('d','d'): return Unit::DD; + case unit_id('c','c'): return Unit::CC; + case unit_id('s','p'): return Unit::SP; } } throw UnitException(string("invalid length unit: ")+unitstr); @@ -125,15 +117,15 @@ Length::Unit Length::stringToUnit (const std::string &unitstr) { string Length::unitToString (Unit unit) { switch (unit) { - case PT: return "pt"; - case BP: return "bp"; - case IN: return "in"; - case CM: return "cm"; - case MM: return "mm"; - case PC: return "pc"; - case DD: return "dd"; - case CC: return "cc"; - case SP: return "sp"; + case Unit::PT: return "pt"; + case Unit::BP: return "bp"; + case Unit::IN: return "in"; + case Unit::CM: return "cm"; + case Unit::MM: return "mm"; + case Unit::PC: return "pc"; + case Unit::DD: return "dd"; + case Unit::CC: return "cc"; + case Unit::SP: return "sp"; } // this isn't supposed to happen return "??"; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.hpp index e9cd5aca788..8c05ae49834 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** Length.h ** +** Length.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,11 +18,11 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_LENGTH_H -#define DVISVGM_LENGTH_H +#ifndef LENGTH_HPP +#define LENGTH_HPP #include <string> -#include "MessageException.h" +#include "MessageException.hpp" #ifdef IN #undef IN @@ -37,11 +37,11 @@ struct UnitException : MessageException class Length { public: - enum Unit {PT, BP, CM, MM, IN, PC, DD, CC, SP}; + enum class Unit {PT, BP, CM, MM, IN, PC, DD, CC, SP}; public: Length () : _pt(0) {} - Length (double val, Unit unit=PT) {set(val, unit);} + Length (double val, Unit unit=Unit::PT) {set(val, unit);} Length (double val, const std::string &unitstr) {set(val, unitstr);} Length (const std::string &lenstr) {set(lenstr);} void set (double val, Unit unit); @@ -63,14 +63,14 @@ class Length static std::string unitToString (Unit unit); public: - static const double pt2bp; - static const double pt2in; - static const double pt2cm; - static const double pt2mm; - static const double pt2pc; - static const double pt2dd; - static const double pt2cc; - static const double pt2sp; + static constexpr double pt2in = 1.0/72.27; + static constexpr double pt2bp = pt2in*72; + static constexpr double pt2cm = pt2in*2.54; + static constexpr double pt2mm = pt2cm*10; + static constexpr double pt2pc = 1.0/12; + static constexpr double pt2dd = 1157.0/1238; + static constexpr double pt2cc = pt2dd/12; + static constexpr double pt2sp = 65536.0; private: double _pt; // length in TeX point units (72.27pt = 1in) diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am index 90ef96d98c5..d2eb2009576 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am @@ -1,237 +1,263 @@ :## This file is part of dvisvgm -## Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> +## Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ## ## Process this file with automake. bin_PROGRAMS = dvisvgm noinst_LIBRARIES = libdvisvgm.a -dvisvgm_SOURCES = gzstream.h \ - dvisvgm.cpp gzstream.cpp +dvisvgm_SOURCES = dvisvgm.cpp dvisvgm_LDADD = \ $(noinst_LIBRARIES) \ - ../clipper/libclipper.a \ - ../xxHash/libxxhash.a \ + ../libs/clipper/libclipper.a \ + ../libs/xxHash/libxxhash.a \ $(FREETYPE_LIBS) \ + $(FONTFORGE_LIBS) \ $(ZLIB_LIBS) +if ENABLE_WOFF +dvisvgm_LDADD += \ + ../libs/ff-woff/libfontforge.a \ + ../libs/woff2/libwoff2.a \ + ../libs/woff2/brotli/libbrotli.a +endif + dvisvgm_DEPENDENCIES = $(noinst_LIBRARIES) libdvisvgm_a_SOURCES = \ - AGLTable.h \ + AGLTable.hpp \ BasicDVIReader.cpp \ - BasicDVIReader.h \ + BasicDVIReader.hpp \ Bezier.cpp \ - Bezier.h \ + Bezier.hpp \ BgColorSpecialHandler.cpp \ - BgColorSpecialHandler.h \ + BgColorSpecialHandler.hpp \ Bitmap.cpp \ - Bitmap.h \ + Bitmap.hpp \ BoundingBox.cpp \ - BoundingBox.h \ + BoundingBox.hpp \ Calculator.cpp \ - Calculator.h \ - Character.h \ + Calculator.hpp \ + Character.hpp \ CharMapID.cpp \ - CharMapID.h \ + CharMapID.hpp \ + CLCommandLine.cpp \ + CLCommandLine.hpp \ + CLOption.hpp \ CMap.cpp \ - CMap.h \ + CMap.hpp \ CMapManager.cpp \ - CMapManager.h \ + CMapManager.hpp \ CMapReader.cpp \ - CMapReader.h \ - CmdLineParserBase.cpp \ - CmdLineParserBase.h \ + CMapReader.hpp \ Color.cpp \ - Color.h \ + Color.hpp \ ColorSpecialHandler.cpp \ - ColorSpecialHandler.h \ - CommandLine.cpp \ - CommandLine.h \ + ColorSpecialHandler.hpp \ + CommandLine.hpp \ CRC32.cpp \ - CRC32.h \ - DependencyGraph.h \ + CRC32.hpp \ + DependencyGraph.hpp \ Directory.cpp \ - Directory.h \ + Directory.hpp \ DLLoader.cpp \ - DLLoader.h \ - DVIActions.h \ + DLLoader.hpp \ + DVIActions.hpp \ DVIReader.cpp \ - DVIReader.h \ + DVIReader.hpp \ DvisvgmSpecialHandler.cpp \ - DvisvgmSpecialHandler.h \ + DvisvgmSpecialHandler.hpp \ DVIToSVG.cpp \ - DVIToSVG.h \ + DVIToSVG.hpp \ DVIToSVGActions.cpp \ - DVIToSVGActions.h \ + DVIToSVGActions.hpp \ EmSpecialHandler.cpp \ - EmSpecialHandler.h \ + EmSpecialHandler.hpp \ EncFile.cpp \ - EncFile.h \ + EncFile.hpp \ EPSFile.cpp \ - EPSFile.h \ + EPSFile.hpp \ EPSToSVG.cpp \ - EPSToSVG.h \ + EPSToSVG.hpp \ FileFinder.cpp \ - FileFinder.h \ + FileFinder.hpp \ FilePath.cpp \ - FilePath.h \ + FilePath.hpp \ FileSystem.cpp \ - FileSystem.h \ + FileSystem.hpp \ + FixWord.hpp \ Font.cpp \ - Font.h \ + Font.hpp \ FontCache.cpp \ - FontCache.h \ + FontCache.hpp \ FontEncoding.cpp \ - FontEncoding.h \ + FontEncoding.hpp \ FontEngine.cpp \ - FontEngine.h \ + FontEngine.hpp \ FontManager.cpp \ - FontManager.h \ + FontManager.hpp \ FontMap.cpp \ - FontMap.h \ + FontMap.hpp \ FontMetrics.cpp \ - FontMetrics.h \ - FontStyle.h \ + FontMetrics.hpp \ + FontStyle.hpp \ + FontWriter.cpp \ + FontWriter.hpp \ GFGlyphTracer.cpp \ - GFGlyphTracer.h \ + GFGlyphTracer.hpp \ GFReader.cpp \ - GFReader.h \ + GFReader.hpp \ GFTracer.cpp \ - GFTracer.h \ + GFTracer.hpp \ Ghostscript.cpp \ - Ghostscript.h \ - Glyph.h \ - GlyphTracerMessages.h \ - GraphicsPath.h \ + Ghostscript.hpp \ + Glyph.hpp \ + GlyphTracerMessages.hpp \ + GraphicsPath.hpp \ HtmlSpecialHandler.cpp \ - HtmlSpecialHandler.h \ + HtmlSpecialHandler.hpp \ InputBuffer.cpp \ - InputBuffer.h \ + InputBuffer.hpp \ InputReader.cpp \ - InputReader.h \ + InputReader.hpp \ JFM.cpp \ - JFM.h \ + JFM.hpp \ Length.cpp \ - Length.h \ - macros.h \ + Length.hpp \ + macros.hpp \ MapLine.cpp \ - MapLine.h \ + MapLine.hpp \ Matrix.cpp \ - Matrix.h \ + Matrix.hpp \ Message.cpp \ - Message.h \ - MessageException.h \ + Message.hpp \ + MessageException.hpp \ MetafontWrapper.cpp \ - MetafontWrapper.h \ + MetafontWrapper.hpp \ NoPsSpecialHandler.cpp \ - NoPsSpecialHandler.h \ - NumericRanges.h \ + NoPsSpecialHandler.hpp \ + NumericRanges.hpp \ PageRanges.cpp \ - PageRanges.h \ + PageRanges.hpp \ PageSize.cpp \ - PageSize.h \ - Pair.h \ + PageSize.hpp \ + Pair.hpp \ PapersizeSpecialHandler.cpp \ - PapersizeSpecialHandler.h \ + PapersizeSpecialHandler.hpp \ PathClipper.cpp \ - PathClipper.h \ + PathClipper.hpp \ PdfSpecialHandler.cpp \ - PdfSpecialHandler.h \ + PdfSpecialHandler.hpp \ PreScanDVIReader.cpp \ - PreScanDVIReader.h \ + PreScanDVIReader.hpp \ Process.cpp \ - Process.h \ + Process.hpp \ psdefs.cpp \ - PSFilter.h \ + PSFilter.hpp \ PSInterpreter.cpp \ - PSInterpreter.h \ + PSInterpreter.hpp \ PSPattern.cpp \ - PSPattern.h \ + PSPattern.hpp \ PSPreviewFilter.cpp \ - PSPreviewFilter.h \ + PSPreviewFilter.hpp \ PsSpecialHandler.cpp \ - PsSpecialHandler.h \ + PsSpecialHandler.hpp \ RangeMap.cpp \ - RangeMap.h \ + RangeMap.hpp \ ShadingPatch.cpp \ - ShadingPatch.h \ + ShadingPatch.hpp \ SignalHandler.cpp \ - SignalHandler.h \ - SpecialActions.h \ - SpecialHandler.h \ + SignalHandler.hpp \ + SpecialActions.hpp \ + SpecialHandler.hpp \ SpecialManager.cpp \ - SpecialManager.h \ + SpecialManager.hpp \ StreamReader.cpp \ - StreamReader.h \ + StreamReader.hpp \ StreamWriter.cpp \ - StreamWriter.h \ + StreamWriter.hpp \ Subfont.cpp \ - Subfont.h \ + Subfont.hpp \ SVGCharHandler.cpp \ - SVGCharHandler.h \ + SVGCharHandler.hpp \ SVGCharHandlerFactory.cpp \ - SVGCharHandlerFactory.h \ + SVGCharHandlerFactory.hpp \ SVGCharPathHandler.cpp \ - SVGCharPathHandler.h \ + SVGCharPathHandler.hpp \ SVGCharTspanTextHandler.cpp \ - SVGCharTspanTextHandler.h \ + SVGCharTspanTextHandler.hpp \ SVGOutput.cpp \ - SVGOutput.h \ + SVGOutput.hpp \ SVGSingleCharTextHandler.cpp \ - SVGSingleCharTextHandler.h \ + SVGSingleCharTextHandler.hpp \ SVGTree.cpp \ - SVGTree.h \ + SVGTree.hpp \ System.cpp \ - System.h \ + System.hpp \ TensorProductPatch.cpp \ - TensorProductPatch.h \ + TensorProductPatch.hpp \ Terminal.cpp \ - Terminal.h \ + Terminal.hpp \ TFM.cpp \ - TFM.h \ + TFM.hpp \ ToUnicodeMap.cpp \ - ToUnicodeMap.h \ + ToUnicodeMap.hpp \ TpicSpecialHandler.cpp \ - TpicSpecialHandler.h \ + TpicSpecialHandler.hpp \ TriangularPatch.cpp \ - TriangularPatch.h \ - types.h \ + TriangularPatch.hpp \ Unicode.cpp \ - Unicode.h \ - VectorIterator.h \ - VectorStream.h \ - VFActions.h \ + Unicode.hpp \ + utility.hpp \ + utility.cpp \ + VectorIterator.hpp \ + VectorStream.hpp \ + version.hpp \ + VFActions.hpp \ VFReader.cpp \ - VFReader.h \ + VFReader.hpp \ XMLDocument.cpp \ - XMLDocument.h \ + XMLDocument.hpp \ XMLNode.cpp \ - XMLNode.h \ + XMLNode.hpp \ XMLString.cpp \ - XMLString.h + XMLString.hpp \ + ZLibOutputStream.hpp + +if ENABLE_WOFF +libdvisvgm_a_SOURCES += ffwrapper.c ffwrapper.h +endif -EXTRA_DIST = options.xml options.dtd iapi.h ierrors.h MiKTeXCom.h MiKTeXCom.cpp +EXTRA_DIST = options.xml options.dtd iapi.h ierrors.h MiKTeXCom.hpp MiKTeXCom.cpp + +AM_CFLAGS = -Wall \ + $(ZLIB_CFLAGS) \ + $(CODE_COVERAGE_CFLAGS) AM_CXXFLAGS = -Wall -Wnon-virtual-dtor \ - -I$(top_srcdir)/clipper \ - -I$(top_srcdir)/xxHash \ + -I$(top_srcdir)/libs/clipper \ + -I$(top_srcdir)/libs/xxHash \ $(FREETYPE_CFLAGS) \ $(ZLIB_CFLAGS) \ $(CODE_COVERAGE_CFLAGS) +if ENABLE_WOFF +AM_CFLAGS += \ + -I$(top_srcdir)/libs/ff-woff/fontforge \ + -I$(top_srcdir)/libs/ff-woff/inc + +AM_CXXFLAGS += \ + -I$(top_srcdir)/libs/woff2/brotli/enc \ + -I$(top_srcdir)/libs/woff2/src +endif + AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) -# the command-line parser is generated from options.xml by opt2cpp -$(srcdir)/CommandLine.cpp: options.xml - if test -f opt2cpp.xsl; then \ - rm -f $@ $*.h; \ - xsltproc opt2cpp.xsl $<; \ - elif test -f $(srcdir)/opt2cpp.py; then \ - rm -f $@ $*.h; \ - python2 $(srcdir)/opt2cpp.py $< $@ $*.h; \ - fi +# the command-line parser class is generated from options.xml by opt2cpp +$(srcdir)/CommandLine.hpp: options.xml + rm -f $@ $*.hpp + python $(srcdir)/opt2cpp.py $< >$@ # Create a C string definition containing the PostScript routines psdefs.ps needed by class PSInterpreter $(srcdir)/psdefs.cpp: psdefs.ps diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.in b/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.in new file mode 100644 index 00000000000..8518606edb9 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.in @@ -0,0 +1,942 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +bin_PROGRAMS = dvisvgm$(EXEEXT) +@ENABLE_WOFF_TRUE@am__append_1 = \ +@ENABLE_WOFF_TRUE@ ../libs/ff-woff/libfontforge.a \ +@ENABLE_WOFF_TRUE@ ../libs/woff2/libwoff2.a \ +@ENABLE_WOFF_TRUE@ ../libs/woff2/brotli/libbrotli.a + +@ENABLE_WOFF_TRUE@am__append_2 = ffwrapper.c ffwrapper.h +@ENABLE_WOFF_TRUE@am__append_3 = \ +@ENABLE_WOFF_TRUE@ -I$(top_srcdir)/libs/ff-woff/fontforge \ +@ENABLE_WOFF_TRUE@ -I$(top_srcdir)/libs/ff-woff/inc + +@ENABLE_WOFF_TRUE@am__append_4 = \ +@ENABLE_WOFF_TRUE@ -I$(top_srcdir)/libs/woff2/brotli/enc \ +@ENABLE_WOFF_TRUE@ -I$(top_srcdir)/libs/woff2/src + +subdir = src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = version.hpp +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +AM_V_AR = $(am__v_AR_@AM_V@) +am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) +am__v_AR_0 = @echo " AR " $@; +am__v_AR_1 = +libdvisvgm_a_AR = $(AR) $(ARFLAGS) +libdvisvgm_a_LIBADD = +am__libdvisvgm_a_SOURCES_DIST = AGLTable.hpp BasicDVIReader.cpp \ + BasicDVIReader.hpp Bezier.cpp Bezier.hpp \ + BgColorSpecialHandler.cpp BgColorSpecialHandler.hpp Bitmap.cpp \ + Bitmap.hpp BoundingBox.cpp BoundingBox.hpp Calculator.cpp \ + Calculator.hpp Character.hpp CharMapID.cpp CharMapID.hpp \ + CLCommandLine.cpp CLCommandLine.hpp CLOption.hpp CMap.cpp \ + CMap.hpp CMapManager.cpp CMapManager.hpp CMapReader.cpp \ + CMapReader.hpp Color.cpp Color.hpp ColorSpecialHandler.cpp \ + ColorSpecialHandler.hpp CommandLine.hpp CRC32.cpp CRC32.hpp \ + DependencyGraph.hpp Directory.cpp Directory.hpp DLLoader.cpp \ + DLLoader.hpp DVIActions.hpp DVIReader.cpp DVIReader.hpp \ + DvisvgmSpecialHandler.cpp DvisvgmSpecialHandler.hpp \ + DVIToSVG.cpp DVIToSVG.hpp DVIToSVGActions.cpp \ + DVIToSVGActions.hpp EmSpecialHandler.cpp EmSpecialHandler.hpp \ + EncFile.cpp EncFile.hpp EPSFile.cpp EPSFile.hpp EPSToSVG.cpp \ + EPSToSVG.hpp FileFinder.cpp FileFinder.hpp FilePath.cpp \ + FilePath.hpp FileSystem.cpp FileSystem.hpp FixWord.hpp \ + Font.cpp Font.hpp FontCache.cpp FontCache.hpp FontEncoding.cpp \ + FontEncoding.hpp FontEngine.cpp FontEngine.hpp FontManager.cpp \ + FontManager.hpp FontMap.cpp FontMap.hpp FontMetrics.cpp \ + FontMetrics.hpp FontStyle.hpp FontWriter.cpp FontWriter.hpp \ + GFGlyphTracer.cpp GFGlyphTracer.hpp GFReader.cpp GFReader.hpp \ + GFTracer.cpp GFTracer.hpp Ghostscript.cpp Ghostscript.hpp \ + Glyph.hpp GlyphTracerMessages.hpp GraphicsPath.hpp \ + HtmlSpecialHandler.cpp HtmlSpecialHandler.hpp InputBuffer.cpp \ + InputBuffer.hpp InputReader.cpp InputReader.hpp JFM.cpp \ + JFM.hpp Length.cpp Length.hpp macros.hpp MapLine.cpp \ + MapLine.hpp Matrix.cpp Matrix.hpp Message.cpp Message.hpp \ + MessageException.hpp MetafontWrapper.cpp MetafontWrapper.hpp \ + NoPsSpecialHandler.cpp NoPsSpecialHandler.hpp \ + NumericRanges.hpp PageRanges.cpp PageRanges.hpp PageSize.cpp \ + PageSize.hpp Pair.hpp PapersizeSpecialHandler.cpp \ + PapersizeSpecialHandler.hpp PathClipper.cpp PathClipper.hpp \ + PdfSpecialHandler.cpp PdfSpecialHandler.hpp \ + PreScanDVIReader.cpp PreScanDVIReader.hpp Process.cpp \ + Process.hpp psdefs.cpp PSFilter.hpp PSInterpreter.cpp \ + PSInterpreter.hpp PSPattern.cpp PSPattern.hpp \ + PSPreviewFilter.cpp PSPreviewFilter.hpp PsSpecialHandler.cpp \ + PsSpecialHandler.hpp RangeMap.cpp RangeMap.hpp \ + ShadingPatch.cpp ShadingPatch.hpp SignalHandler.cpp \ + SignalHandler.hpp SpecialActions.hpp SpecialHandler.hpp \ + SpecialManager.cpp SpecialManager.hpp StreamReader.cpp \ + StreamReader.hpp StreamWriter.cpp StreamWriter.hpp Subfont.cpp \ + Subfont.hpp SVGCharHandler.cpp SVGCharHandler.hpp \ + SVGCharHandlerFactory.cpp SVGCharHandlerFactory.hpp \ + SVGCharPathHandler.cpp SVGCharPathHandler.hpp \ + SVGCharTspanTextHandler.cpp SVGCharTspanTextHandler.hpp \ + SVGOutput.cpp SVGOutput.hpp SVGSingleCharTextHandler.cpp \ + SVGSingleCharTextHandler.hpp SVGTree.cpp SVGTree.hpp \ + System.cpp System.hpp TensorProductPatch.cpp \ + TensorProductPatch.hpp Terminal.cpp Terminal.hpp TFM.cpp \ + TFM.hpp ToUnicodeMap.cpp ToUnicodeMap.hpp \ + TpicSpecialHandler.cpp TpicSpecialHandler.hpp \ + TriangularPatch.cpp TriangularPatch.hpp Unicode.cpp \ + Unicode.hpp utility.hpp utility.cpp VectorIterator.hpp \ + VectorStream.hpp version.hpp VFActions.hpp VFReader.cpp \ + VFReader.hpp XMLDocument.cpp XMLDocument.hpp XMLNode.cpp \ + XMLNode.hpp XMLString.cpp XMLString.hpp ZLibOutputStream.hpp \ + ffwrapper.c ffwrapper.h +@ENABLE_WOFF_TRUE@am__objects_1 = ffwrapper.$(OBJEXT) +am_libdvisvgm_a_OBJECTS = BasicDVIReader.$(OBJEXT) Bezier.$(OBJEXT) \ + BgColorSpecialHandler.$(OBJEXT) Bitmap.$(OBJEXT) \ + BoundingBox.$(OBJEXT) Calculator.$(OBJEXT) CharMapID.$(OBJEXT) \ + CLCommandLine.$(OBJEXT) CMap.$(OBJEXT) CMapManager.$(OBJEXT) \ + CMapReader.$(OBJEXT) Color.$(OBJEXT) \ + ColorSpecialHandler.$(OBJEXT) CRC32.$(OBJEXT) \ + Directory.$(OBJEXT) DLLoader.$(OBJEXT) DVIReader.$(OBJEXT) \ + DvisvgmSpecialHandler.$(OBJEXT) DVIToSVG.$(OBJEXT) \ + DVIToSVGActions.$(OBJEXT) EmSpecialHandler.$(OBJEXT) \ + EncFile.$(OBJEXT) EPSFile.$(OBJEXT) EPSToSVG.$(OBJEXT) \ + FileFinder.$(OBJEXT) FilePath.$(OBJEXT) FileSystem.$(OBJEXT) \ + Font.$(OBJEXT) FontCache.$(OBJEXT) FontEncoding.$(OBJEXT) \ + FontEngine.$(OBJEXT) FontManager.$(OBJEXT) FontMap.$(OBJEXT) \ + FontMetrics.$(OBJEXT) FontWriter.$(OBJEXT) \ + GFGlyphTracer.$(OBJEXT) GFReader.$(OBJEXT) GFTracer.$(OBJEXT) \ + Ghostscript.$(OBJEXT) HtmlSpecialHandler.$(OBJEXT) \ + InputBuffer.$(OBJEXT) InputReader.$(OBJEXT) JFM.$(OBJEXT) \ + Length.$(OBJEXT) MapLine.$(OBJEXT) Matrix.$(OBJEXT) \ + Message.$(OBJEXT) MetafontWrapper.$(OBJEXT) \ + NoPsSpecialHandler.$(OBJEXT) PageRanges.$(OBJEXT) \ + PageSize.$(OBJEXT) PapersizeSpecialHandler.$(OBJEXT) \ + PathClipper.$(OBJEXT) PdfSpecialHandler.$(OBJEXT) \ + PreScanDVIReader.$(OBJEXT) Process.$(OBJEXT) psdefs.$(OBJEXT) \ + PSInterpreter.$(OBJEXT) PSPattern.$(OBJEXT) \ + PSPreviewFilter.$(OBJEXT) PsSpecialHandler.$(OBJEXT) \ + RangeMap.$(OBJEXT) ShadingPatch.$(OBJEXT) \ + SignalHandler.$(OBJEXT) SpecialManager.$(OBJEXT) \ + StreamReader.$(OBJEXT) StreamWriter.$(OBJEXT) \ + Subfont.$(OBJEXT) SVGCharHandler.$(OBJEXT) \ + SVGCharHandlerFactory.$(OBJEXT) SVGCharPathHandler.$(OBJEXT) \ + SVGCharTspanTextHandler.$(OBJEXT) SVGOutput.$(OBJEXT) \ + SVGSingleCharTextHandler.$(OBJEXT) SVGTree.$(OBJEXT) \ + System.$(OBJEXT) TensorProductPatch.$(OBJEXT) \ + Terminal.$(OBJEXT) TFM.$(OBJEXT) ToUnicodeMap.$(OBJEXT) \ + TpicSpecialHandler.$(OBJEXT) TriangularPatch.$(OBJEXT) \ + Unicode.$(OBJEXT) utility.$(OBJEXT) VFReader.$(OBJEXT) \ + XMLDocument.$(OBJEXT) XMLNode.$(OBJEXT) XMLString.$(OBJEXT) \ + $(am__objects_1) +libdvisvgm_a_OBJECTS = $(am_libdvisvgm_a_OBJECTS) +am__installdirs = "$(DESTDIR)$(bindir)" +PROGRAMS = $(bin_PROGRAMS) +am_dvisvgm_OBJECTS = dvisvgm.$(OBJEXT) +dvisvgm_OBJECTS = $(am_dvisvgm_OBJECTS) +am__DEPENDENCIES_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(libdvisvgm_a_SOURCES) $(dvisvgm_SOURCES) +DIST_SOURCES = $(am__libdvisvgm_a_SOURCES_DIST) $(dvisvgm_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/version.hpp.in \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CPPFLAGS = @AM_CPPFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATE = @DATE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +GCOV = @GCOV@ +GENHTML = @GENHTML@ +GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LCOV = @LCOV@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LIBRARIES = libdvisvgm.a +dvisvgm_SOURCES = dvisvgm.cpp +dvisvgm_LDADD = $(noinst_LIBRARIES) ../libs/clipper/libclipper.a \ + ../libs/xxHash/libxxhash.a $(FREETYPE_LIBS) $(FONTFORGE_LIBS) \ + $(ZLIB_LIBS) $(am__append_1) +dvisvgm_DEPENDENCIES = $(noinst_LIBRARIES) +libdvisvgm_a_SOURCES = AGLTable.hpp BasicDVIReader.cpp \ + BasicDVIReader.hpp Bezier.cpp Bezier.hpp \ + BgColorSpecialHandler.cpp BgColorSpecialHandler.hpp Bitmap.cpp \ + Bitmap.hpp BoundingBox.cpp BoundingBox.hpp Calculator.cpp \ + Calculator.hpp Character.hpp CharMapID.cpp CharMapID.hpp \ + CLCommandLine.cpp CLCommandLine.hpp CLOption.hpp CMap.cpp \ + CMap.hpp CMapManager.cpp CMapManager.hpp CMapReader.cpp \ + CMapReader.hpp Color.cpp Color.hpp ColorSpecialHandler.cpp \ + ColorSpecialHandler.hpp CommandLine.hpp CRC32.cpp CRC32.hpp \ + DependencyGraph.hpp Directory.cpp Directory.hpp DLLoader.cpp \ + DLLoader.hpp DVIActions.hpp DVIReader.cpp DVIReader.hpp \ + DvisvgmSpecialHandler.cpp DvisvgmSpecialHandler.hpp \ + DVIToSVG.cpp DVIToSVG.hpp DVIToSVGActions.cpp \ + DVIToSVGActions.hpp EmSpecialHandler.cpp EmSpecialHandler.hpp \ + EncFile.cpp EncFile.hpp EPSFile.cpp EPSFile.hpp EPSToSVG.cpp \ + EPSToSVG.hpp FileFinder.cpp FileFinder.hpp FilePath.cpp \ + FilePath.hpp FileSystem.cpp FileSystem.hpp FixWord.hpp \ + Font.cpp Font.hpp FontCache.cpp FontCache.hpp FontEncoding.cpp \ + FontEncoding.hpp FontEngine.cpp FontEngine.hpp FontManager.cpp \ + FontManager.hpp FontMap.cpp FontMap.hpp FontMetrics.cpp \ + FontMetrics.hpp FontStyle.hpp FontWriter.cpp FontWriter.hpp \ + GFGlyphTracer.cpp GFGlyphTracer.hpp GFReader.cpp GFReader.hpp \ + GFTracer.cpp GFTracer.hpp Ghostscript.cpp Ghostscript.hpp \ + Glyph.hpp GlyphTracerMessages.hpp GraphicsPath.hpp \ + HtmlSpecialHandler.cpp HtmlSpecialHandler.hpp InputBuffer.cpp \ + InputBuffer.hpp InputReader.cpp InputReader.hpp JFM.cpp \ + JFM.hpp Length.cpp Length.hpp macros.hpp MapLine.cpp \ + MapLine.hpp Matrix.cpp Matrix.hpp Message.cpp Message.hpp \ + MessageException.hpp MetafontWrapper.cpp MetafontWrapper.hpp \ + NoPsSpecialHandler.cpp NoPsSpecialHandler.hpp \ + NumericRanges.hpp PageRanges.cpp PageRanges.hpp PageSize.cpp \ + PageSize.hpp Pair.hpp PapersizeSpecialHandler.cpp \ + PapersizeSpecialHandler.hpp PathClipper.cpp PathClipper.hpp \ + PdfSpecialHandler.cpp PdfSpecialHandler.hpp \ + PreScanDVIReader.cpp PreScanDVIReader.hpp Process.cpp \ + Process.hpp psdefs.cpp PSFilter.hpp PSInterpreter.cpp \ + PSInterpreter.hpp PSPattern.cpp PSPattern.hpp \ + PSPreviewFilter.cpp PSPreviewFilter.hpp PsSpecialHandler.cpp \ + PsSpecialHandler.hpp RangeMap.cpp RangeMap.hpp \ + ShadingPatch.cpp ShadingPatch.hpp SignalHandler.cpp \ + SignalHandler.hpp SpecialActions.hpp SpecialHandler.hpp \ + SpecialManager.cpp SpecialManager.hpp StreamReader.cpp \ + StreamReader.hpp StreamWriter.cpp StreamWriter.hpp Subfont.cpp \ + Subfont.hpp SVGCharHandler.cpp SVGCharHandler.hpp \ + SVGCharHandlerFactory.cpp SVGCharHandlerFactory.hpp \ + SVGCharPathHandler.cpp SVGCharPathHandler.hpp \ + SVGCharTspanTextHandler.cpp SVGCharTspanTextHandler.hpp \ + SVGOutput.cpp SVGOutput.hpp SVGSingleCharTextHandler.cpp \ + SVGSingleCharTextHandler.hpp SVGTree.cpp SVGTree.hpp \ + System.cpp System.hpp TensorProductPatch.cpp \ + TensorProductPatch.hpp Terminal.cpp Terminal.hpp TFM.cpp \ + TFM.hpp ToUnicodeMap.cpp ToUnicodeMap.hpp \ + TpicSpecialHandler.cpp TpicSpecialHandler.hpp \ + TriangularPatch.cpp TriangularPatch.hpp Unicode.cpp \ + Unicode.hpp utility.hpp utility.cpp VectorIterator.hpp \ + VectorStream.hpp version.hpp VFActions.hpp VFReader.cpp \ + VFReader.hpp XMLDocument.cpp XMLDocument.hpp XMLNode.cpp \ + XMLNode.hpp XMLString.cpp XMLString.hpp ZLibOutputStream.hpp \ + $(am__append_2) +EXTRA_DIST = options.xml options.dtd iapi.h ierrors.h MiKTeXCom.hpp MiKTeXCom.cpp +AM_CFLAGS = -Wall $(ZLIB_CFLAGS) $(CODE_COVERAGE_CFLAGS) \ + $(am__append_3) +AM_CXXFLAGS = -Wall -Wnon-virtual-dtor -I$(top_srcdir)/libs/clipper \ + -I$(top_srcdir)/libs/xxHash $(FREETYPE_CFLAGS) $(ZLIB_CFLAGS) \ + $(CODE_COVERAGE_CFLAGS) $(am__append_4) +CLEANFILES = *.gcda *.gcno +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .cpp .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +version.hpp: $(top_builddir)/config.status $(srcdir)/version.hpp.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +libdvisvgm.a: $(libdvisvgm_a_OBJECTS) $(libdvisvgm_a_DEPENDENCIES) $(EXTRA_libdvisvgm_a_DEPENDENCIES) + $(AM_V_at)-rm -f libdvisvgm.a + $(AM_V_AR)$(libdvisvgm_a_AR) libdvisvgm.a $(libdvisvgm_a_OBJECTS) $(libdvisvgm_a_LIBADD) + $(AM_V_at)$(RANLIB) libdvisvgm.a +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +dvisvgm$(EXEEXT): $(dvisvgm_OBJECTS) $(dvisvgm_DEPENDENCIES) $(EXTRA_dvisvgm_DEPENDENCIES) + @rm -f dvisvgm$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(dvisvgm_OBJECTS) $(dvisvgm_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BasicDVIReader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Bezier.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BgColorSpecialHandler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Bitmap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BoundingBox.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CLCommandLine.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CMap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CMapManager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CMapReader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CRC32.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Calculator.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CharMapID.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Color.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ColorSpecialHandler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DLLoader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DVIReader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DVIToSVG.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DVIToSVGActions.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Directory.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DvisvgmSpecialHandler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/EPSFile.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/EPSToSVG.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/EmSpecialHandler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/EncFile.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileFinder.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FilePath.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileSystem.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Font.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FontCache.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FontEncoding.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FontEngine.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FontManager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FontMap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FontMetrics.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FontWriter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GFGlyphTracer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GFReader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GFTracer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Ghostscript.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HtmlSpecialHandler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InputBuffer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InputReader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JFM.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Length.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MapLine.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Matrix.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Message.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetafontWrapper.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NoPsSpecialHandler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PSInterpreter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PSPattern.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PSPreviewFilter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PageRanges.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PageSize.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PapersizeSpecialHandler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PathClipper.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PdfSpecialHandler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PreScanDVIReader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Process.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsSpecialHandler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RangeMap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGCharHandler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGCharHandlerFactory.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGCharPathHandler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGCharTspanTextHandler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGOutput.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGSingleCharTextHandler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGTree.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ShadingPatch.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SignalHandler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SpecialManager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StreamReader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StreamWriter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Subfont.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/System.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TFM.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TensorProductPatch.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Terminal.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ToUnicodeMap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TpicSpecialHandler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TriangularPatch.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Unicode.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VFReader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XMLDocument.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XMLNode.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XMLString.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvisvgm.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffwrapper.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psdefs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utility.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-noinstLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ + clean-binPROGRAMS clean-generic clean-noinstLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-binPROGRAMS + +.PRECIOUS: Makefile + +:## This file is part of dvisvgm + +# the command-line parser class is generated from options.xml by opt2cpp +$(srcdir)/CommandLine.hpp: options.xml + rm -f $@ $*.hpp + python $(srcdir)/opt2cpp.py $< >$@ + +# Create a C string definition containing the PostScript routines psdefs.ps needed by class PSInterpreter +$(srcdir)/psdefs.cpp: psdefs.ps + if test -f $<; then \ + ps2c PSInterpreter::PSDEFS $< >$@; \ + fi + +psdefs.ps: ; + +@CODE_COVERAGE_RULES@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp index e972dd55ad3..49809861199 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp @@ -2,7 +2,7 @@ ** MapLine.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -21,10 +21,10 @@ #include <config.h> #include <cstring> #include <sstream> -#include "InputBuffer.h" -#include "InputReader.h" -#include "MapLine.h" -#include "Subfont.h" +#include "InputBuffer.hpp" +#include "InputReader.hpp" +#include "MapLine.hpp" +#include "Subfont.hpp" using namespace std; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.hpp index e2e7afc426e..9dcb568792a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** MapLine.h ** +** MapLine.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,12 +18,12 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_MAPLINE_H -#define DVISVGM_MAPLINE_H +#ifndef MAPLINE_HPP +#define MAPLINE_HPP #include <istream> #include <string> -#include "MessageException.h" +#include "MessageException.hpp" class InputReader; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp index 90bb4c29a47..83ef1ccfbb5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp @@ -2,7 +2,7 @@ ** Matrix.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -24,9 +24,9 @@ #include <cmath> #include <limits> #include <sstream> -#include "Calculator.h" -#include "Matrix.h" -#include "XMLString.h" +#include "Calculator.hpp" +#include "Matrix.hpp" +#include "XMLString.hpp" using namespace std; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.hpp index 9c84ec18990..0d8917f56ae 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** Matrix.h ** +** Matrix.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,14 +18,14 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_MATRIX_H -#define DVISVGM_MATRIX_H +#ifndef MATRIX_HPP +#define MATRIX_HPP #include <istream> #include <string> #include <vector> -#include "MessageException.h" -#include "Pair.h" +#include "MessageException.hpp" +#include "Pair.hpp" struct ParserException : public MessageException diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.cpp index 40b0909f173..7e60ad3b9fa 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.cpp @@ -2,7 +2,7 @@ ** Message.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -24,8 +24,8 @@ #include <cstring> #include <iostream> #include <map> -#include "Message.h" -#include "Terminal.h" +#include "Message.hpp" +#include "Terminal.hpp" using namespace std; @@ -234,15 +234,16 @@ void Message::init () { _classColors[MC_PROGRESS] = Color(Terminal::MAGENTA); if (const char *color_str = getenv("DVISVGM_COLORS")) { - map<string, MessageClass> classes; - classes["er"] = MC_ERROR; - classes["wn"] = MC_WARNING; - classes["pn"] = MC_PAGE_NUMBER; - classes["ps"] = MC_PAGE_SIZE; - classes["fw"] = MC_PAGE_WRITTEN; - classes["sm"] = MC_STATE; - classes["tr"] = MC_TRACING; - classes["pi"] = MC_PROGRESS; + map<string, MessageClass> classes = { + {"er", MC_ERROR}, + {"wn", MC_WARNING}, + {"pn", MC_PAGE_NUMBER}, + {"ps", MC_PAGE_SIZE}, + {"fw", MC_PAGE_WRITTEN}, + {"sm", MC_STATE}, + {"tr", MC_TRACING}, + {"pi", MC_PROGRESS}, + }; const char *p=color_str; // skip leading whitespace @@ -251,7 +252,7 @@ void Message::init () { // iterate over color assignments while (strlen(p) >= 5) { - map<string, MessageClass>::iterator it = classes.find(string(p, 2)); + auto it = classes.find(string(p, 2)); if (it != classes.end() && p[2] == '=') { int bgcolor, fgcolor; if (colorchar2int(p[3], &bgcolor) && colorchar2int(p[4], &fgcolor)) { diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.hpp index 42ec15955f2..f05eb6aa0ed 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** Message.h ** +** Message.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,15 +18,15 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_MESSAGE_H -#define DVISVGM_MESSAGE_H +#ifndef MESSAGE_HPP +#define MESSAGE_HPP #include <algorithm> +#include <cstdint> #include <string> #include <ostream> #include <sstream> -#include "Terminal.h" -#include "types.h" +#include "Terminal.hpp" class Message; @@ -73,11 +73,11 @@ class Message { struct Color { Color () : foreground(-1), background(-1) {} - Color (Int8 fgcolor) : foreground(fgcolor), background(-1) {} - Color (Int8 fgcolor, bool light) : foreground(fgcolor + (light ? 8 : 0)), background(-1) {} - Color (Int8 fgcolor, Int8 bgcolor) : foreground(fgcolor), background(bgcolor) {} - Int8 foreground; - Int8 background; + Color (int8_t fgcolor) : foreground(fgcolor), background(-1) {} + Color (int8_t fgcolor, bool light) : foreground(fgcolor + (light ? 8 : 0)), background(-1) {} + Color (int8_t fgcolor, int8_t bgcolor) : foreground(fgcolor), background(bgcolor) {} + int8_t foreground; + int8_t background; }; public: diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MessageException.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/MessageException.hpp index f5c35cae046..d94a1feab8a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MessageException.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MessageException.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** MessageException.h ** +** MessageException.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,8 +18,8 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_MESSAGEEXCEPTION_H -#define DVISVGM_MESSAGEEXCEPTION_H +#ifndef MESSAGEEXCEPTION_HPP +#define MESSAGEEXCEPTION_HPP #include <exception> #include <string> @@ -29,8 +29,8 @@ class MessageException : public std::exception { public: MessageException (const std::string &msg) : _message(msg) {} - virtual ~MessageException () throw() {} - const char* what () const throw() {return _message.c_str();} + virtual ~MessageException () throw() =default; + const char* what () const throw() override {return _message.c_str();} private: std::string _message; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.cpp index 26f43984679..dd2a6cf2941 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.cpp @@ -2,7 +2,7 @@ ** MetafontWrapper.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -23,18 +23,23 @@ #include <cctype> #include <fstream> #include <sstream> -#include "FileSystem.h" -#include "FileFinder.h" -#include "Message.h" -#include "MetafontWrapper.h" -#include "Process.h" -#include "XMLString.h" +#include "FileSystem.hpp" +#include "FileFinder.hpp" +#include "Message.hpp" +#include "MetafontWrapper.hpp" +#include "Process.hpp" +#include "XMLString.hpp" using namespace std; -MetafontWrapper::MetafontWrapper (const string &fname) : _fontname(fname) +MetafontWrapper::MetafontWrapper (const string &fname, const string &dir) : _fontname(fname), _dir(dir) { + // ensure that folder paths ends with slash + if (_dir.empty()) + _dir = "./"; + else if (_dir != "/" && dir[dir.length()-1] != '/') + _dir += '/'; } @@ -45,7 +50,7 @@ MetafontWrapper::MetafontWrapper (const string &fname) : _fontname(fname) * @param[in] mag magnification factor * @return true on success */ bool MetafontWrapper::call (const string &mode, double mag) { - if (!FileFinder::lookup(_fontname+".mf")) + if (!FileFinder::instance().lookup(_fontname+".mf")) return false; // mf file not available => no need to call the "slow" Metafont FileSystem::remove(_fontname+".gf"); @@ -55,7 +60,7 @@ bool MetafontWrapper::call (const string &mode, double mag) { #else const char *mfname = "mf.exe"; #endif - const char *cmd = FileFinder::lookup(mfname, false); + const char *cmd = FileFinder::instance().lookup(mfname, false); if (!cmd) { Message::estream(true) << "can't run Metafont (" << mfname << " not found)\n"; return false; @@ -73,7 +78,7 @@ bool MetafontWrapper::call (const string &mode, double mag) { Message::mstream(false, Message::MC_STATE) << "\nrunning Metafont for " << _fontname << '\n'; Process mf_process(cmd, oss.str().c_str()); string mf_messages; - mf_process.run(&mf_messages); + mf_process.run(_dir, &mf_messages); // get resolution value from stdout created by above MF command char buf[256]; @@ -88,12 +93,12 @@ bool MetafontWrapper::call (const string &mode, double mag) { } } // compose expected name of GF file (see Metafont Book, p. 324) - string gfname = _fontname + "."; + string gfname = _dir + _fontname + "."; if (resolution > 0) gfname += XMLString(resolution); gfname += "gf"; - FileSystem::rename(gfname, _fontname+".gf"); // remove resolution from filename - return FileSystem::exists(_fontname+".gf"); + FileSystem::rename(gfname, _dir+_fontname+".gf"); // remove resolution value from filename + return FileSystem::exists(_dir+_fontname+".gf"); } @@ -102,8 +107,8 @@ bool MetafontWrapper::call (const string &mode, double mag) { * @param[in] mag magnification factor * @return true on success */ bool MetafontWrapper::make (const string &mode, double mag) { - ifstream tfm((_fontname+".tfm").c_str()); - ifstream gf((_fontname+".gf").c_str()); + ifstream tfm((_dir+_fontname+".tfm").c_str()); + ifstream gf((_dir+_fontname+".gf").c_str()); if (gf && tfm) // @@ distinguish between gf and tfm return true; return call(mode, mag); @@ -111,24 +116,7 @@ bool MetafontWrapper::make (const string &mode, double mag) { bool MetafontWrapper::success () const { - ifstream tfm((_fontname+".tfm").c_str()); - ifstream gf((_fontname+".gf").c_str()); + ifstream tfm((_dir+_fontname+".tfm").c_str()); + ifstream gf((_dir+_fontname+".gf").c_str()); return tfm && gf; } - - -/** Remove all files created by a Metafont call (tfm, gf, log). - * @param[in] keepGF if true, GF files won't be removed */ -void MetafontWrapper::removeOutputFiles (bool keepGF) { - removeOutputFiles(_fontname, keepGF); -} - - -/** Remove all files created by a Metafont call for a given font (tfm, gf, log). - * @param[in] fontname name of font whose temporary files should be removed - * @param[in] keepGF if true, GF files will be kept */ -void MetafontWrapper::removeOutputFiles (const string &fontname, bool keepGF) { - const char *ext[] = {"gf", "tfm", "log", 0}; - for (const char **p = keepGF ? ext+2 : ext; *p; ++p) - FileSystem::remove(fontname + "." + *p); -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.hpp index bf035b374ab..3bda79c5683 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** MetafontWrapper.h ** +** MetafontWrapper.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,26 +18,25 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_METAFONTWRAPPER_H -#define DVISVGM_METAFONTWRAPPER_H +#ifndef METAFONTWRAPPER_HPP +#define METAFONTWRAPPER_HPP #include <string> -struct FileFinder; +class FileFinder; class MetafontWrapper { public: - MetafontWrapper (const std::string &fontname); + MetafontWrapper (const std::string &fontname, const std::string &dir); bool call (const std::string &mode, double mag); bool make (const std::string &mode, double mag); bool success () const; - void removeOutputFiles (bool keepGF=false); - static void removeOutputFiles (const std::string &fontname, bool keepGF=false); private: std::string _fontname; + std::string _dir; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp index 8927ebbf834..bdb0cc89073 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp @@ -2,7 +2,7 @@ ** MiKTeXCom.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -22,9 +22,8 @@ #include <stdio.h> #include <comdef.h> #include <string> -#include "MessageException.h" -#include "MiKTeXCom.h" -#include "macros.h" +#include "MessageException.hpp" +#include "MiKTeXCom.hpp" using namespace std; @@ -36,7 +35,7 @@ MiKTeXCom::MiKTeXCom () : _session(0) { // try to initialize the MiKTeX session object #ifdef _MSC_VER HRESULT hres = _session.CreateInstance(L"MiKTeX.Session"); -#elif defined(__WIN64__) +#elif defined(_WIN64) HRESULT hres = CoCreateInstance(CLSID_MiKTeXSession2_9, 0, CLSCTX_LOCAL_SERVER, IID_ISession2, (void**)&_session); #else HRESULT hres = CoCreateInstance(CLSID_MiKTeXSession2_9, 0, CLSCTX_INPROC_SERVER, IID_ISession2, (void**)&_session); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.hpp index 834a7f4d905..a87a8488c7c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** MiKTeXCom.h ** +** MiKTeXCom.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,8 +18,8 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_MIKTEXCOM_H -#define DVISVGM_MIKTEXCOM_H +#ifndef MIKTEXCOM_HPP +#define MIKTEXCOM_HPP #include <string> diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.cpp index fd85cc0ffac..a5b2a680ebc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.cpp @@ -2,7 +2,7 @@ ** NoPsSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,8 +19,8 @@ *************************************************************************/ #include <config.h> -#include "Message.h" -#include "NoPsSpecialHandler.h" +#include "Message.hpp" +#include "NoPsSpecialHandler.hpp" using namespace std; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.hpp index 777656e8ad3..bec66478864 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** NoPsSpecialHandler.h ** +** NoPsSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,22 +18,22 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_NOPSSPECIALHANDLER_H -#define DVISVGM_NOPSSPECIALHANDLER_H +#ifndef NOPSSPECIALHANDLER_HPP +#define NOPSSPECIALHANDLER_HPP -#include "SpecialHandler.h" +#include "SpecialHandler.hpp" class NoPsSpecialHandler : public SpecialHandler, public DVIEndPageListener { public: NoPsSpecialHandler () : _count(0) {} - bool process (const char *prefix, std::istream &is, SpecialActions &actions); - const char* name () const {return 0;} - const char* info () const {return 0;} - const char** prefixes () const; + bool process (const char *prefix, std::istream &is, SpecialActions &actions) override; + const char* name () const override {return 0;} + const char* info () const override {return 0;} + const char** prefixes () const override; protected: - void dviEndPage (unsigned pageno, SpecialActions &actions); + void dviEndPage (unsigned pageno, SpecialActions &actions) override; private: unsigned _count; // number of PS specials skipped diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/NumericRanges.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/NumericRanges.hpp index 486213887de..c87eddf054f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/NumericRanges.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/NumericRanges.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** NumericRanges.h ** +** NumericRanges.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,8 +18,8 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_NUMERICRANGES_H -#define DVISVGM_NUMERICRANGES_H +#ifndef NUMERICRANGES_HPP +#define NUMERICRANGES_HPP #include <algorithm> #include <list> @@ -31,7 +31,6 @@ class NumericRanges public: typedef std::pair<T,T> Range; typedef std::list<Range> Container; - typedef typename Container::iterator Iterator; typedef typename Container::const_iterator ConstIterator; public: @@ -43,9 +42,6 @@ class NumericRanges ConstIterator end () const {return _ranges.end();} const Container& ranges () const {return _ranges;} - protected: - static bool isLess (const Range &r1, const Range &r2) {return r1.first < r2.first;} - private: Container _ranges; }; @@ -102,7 +98,10 @@ void NumericRanges<T>::addRange (T first, T last) { template <class T> bool NumericRanges<T>::valueExists (T value) const { - ConstIterator it = std::lower_bound(_ranges.begin(), _ranges.end(), Range(value, 0), &isLess); + ConstIterator it = std::lower_bound(_ranges.begin(), _ranges.end(), Range(value, 0), + [](const Range &r1, const Range &r2) { + return r1.first < r2.first; + }); return (it != _ranges.end() && it->first <= value && it->second >= value); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSFilter.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSFilter.hpp index c3d6c87ad7c..61adb5af36e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSFilter.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSFilter.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** PSFilter.h ** +** PSFilter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,16 +18,16 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_PSFILTER_H -#define DVISVGM_PSFILTER_H +#ifndef PSFILTER_HPP +#define PSFILTER_HPP class PSInterpreter; class PSFilter { public: - PSFilter (PSInterpreter &psi) : _psi(psi) {} - virtual ~PSFilter () {} + explicit PSFilter (PSInterpreter &psi) : _psi(psi) {} + virtual ~PSFilter () =default; virtual void execute (const char *code, size_t len) =0; virtual bool active () const =0; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp index 77da4520bec..407f0eb32e7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp @@ -2,7 +2,7 @@ ** PSInterpreter.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -22,12 +22,12 @@ #include <cstring> #include <fstream> #include <sstream> -#include "FileFinder.h" -#include "InputReader.h" -#include "Message.h" -#include "PSFilter.h" -#include "PSInterpreter.h" -#include "SignalHandler.h" +#include "FileFinder.hpp" +#include "InputReader.hpp" +#include "Message.hpp" +#include "PSFilter.hpp" +#include "PSInterpreter.hpp" +#include "SignalHandler.hpp" using namespace std; @@ -314,7 +314,7 @@ void PSInterpreter::callActions (InputReader &in) { _rawData.clear(); in.skipSpace(); while (!in.eof()) { - _rawData.push_back(in.getString()); + _rawData.emplace_back(in.getString()); in.skipSpace(); } } @@ -325,14 +325,14 @@ void PSInterpreter::callActions (InputReader &in) { if (pcount < 0) { // variable number of parameters? in.skipSpace(); while (!in.eof()) { // read all available parameters - params.push_back(in.getString()); + params.emplace_back(in.getString()); in.skipSpace(); } } else { // fix number of parameters for (int i=0; i < pcount; i++) { in.skipSpace(); - params.push_back(in.getString()); + params.emplace_back(in.getString()); } } vector<double> v(params.size()); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.hpp index b257068a416..d3ae0733b54 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** PSInterpreter.h ** +** PSInterpreter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,16 +18,16 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_PSINTERPRETER_H -#define DVISVGM_PSINTERPRETER_H +#ifndef PSINTERPRETER_HPP +#define PSINTERPRETER_HPP #include <cstring> #include <istream> #include <string> #include <vector> -#include "Ghostscript.h" -#include "InputReader.h" -#include "MessageException.h" +#include "Ghostscript.hpp" +#include "InputReader.hpp" +#include "MessageException.hpp" struct PSException : public MessageException @@ -40,7 +40,7 @@ struct PSException : public MessageException * Each method corresponds to a PostScript operator of the same name. */ struct PSActions { - virtual ~PSActions () {} + virtual ~PSActions () =default; virtual void applyscalevals (std::vector<double> &p) =0; virtual void clip (std::vector<double> &p) =0; virtual void clippath (std::vector<double> &p) =0; @@ -89,7 +89,8 @@ class PSInterpreter enum Mode {PS_NONE, PS_RUNNING, PS_QUIT}; public: - PSInterpreter (PSActions *actions=0); + explicit PSInterpreter (PSActions *actions=0); + PSInterpreter (const PSInterpreter &psi) =delete; bool execute (const char *str, size_t len, bool flush=true); bool execute (const char *str, bool flush=true) {return execute(str, std::strlen(str), flush);} bool execute (const std::string &str, bool flush=true) {return execute(str.c_str(), flush);} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.cpp index 47e151dd90a..cbcd7f1e10a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.cpp @@ -2,7 +2,7 @@ ** PSPattern.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -21,11 +21,11 @@ #include <config.h> #include <sstream> #include <vector> -#include "BoundingBox.h" -#include "PSPattern.h" -#include "SpecialActions.h" -#include "SVGTree.h" -#include "XMLNode.h" +#include "BoundingBox.hpp" +#include "PSPattern.hpp" +#include "SpecialActions.hpp" +#include "SVGTree.hpp" +#include "XMLNode.hpp" using namespace std; @@ -155,9 +155,9 @@ void PSUncoloredTilingPattern::apply (SpecialActions &actions) { const char *attribs[] = {"fill", "stroke"}; for (int i=0; i < 2; i++) { getGroupNode()->getDescendants(0, attribs[i], colored_elems); - for (vector<XMLElementNode*>::iterator it=colored_elems.begin(); it != colored_elems.end(); ++it) - if (string((*it)->getAttributeValue(attribs[i])) != "none") - (*it)->addAttribute(attribs[i], _currentColor.svgColorString()); + for (XMLElementNode *elem : colored_elems) + if (string(elem->getAttributeValue(attribs[i])) != "none") + elem->addAttribute(attribs[i], _currentColor.svgColorString()); colored_elems.clear(); } PSPattern::apply(actions); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.hpp index 594e819049c..122ae590f82 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** PSPattern.h ** +** PSPattern.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,14 +18,14 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_PSPATTERN_H -#define DVISVGM_PSPATTERN_H +#ifndef PSPATTERN_HPP +#define PSPATTERN_HPP #include <set> #include <string> -#include "BoundingBox.h" -#include "Color.h" -#include "Matrix.h" +#include "BoundingBox.hpp" +#include "Color.hpp" +#include "Matrix.hpp" class SpecialActions; @@ -35,7 +35,7 @@ class XMLElementNode; class PSPattern { public: - virtual ~PSPattern () {} + virtual ~PSPattern () =default; virtual int psID () const {return _id;} virtual std::string svgID () const; virtual void apply (SpecialActions &actions); @@ -54,11 +54,11 @@ class PSTilingPattern : public PSPattern public: ~PSTilingPattern (); virtual XMLElementNode* getContainerNode () {return _groupNode;} - void apply (SpecialActions &actions); + void apply (SpecialActions &actions) override; protected: PSTilingPattern (int id, BoundingBox &bbox, Matrix &matrix, double xstep, double ystep); - XMLElementNode* createPatternNode () const; + XMLElementNode* createPatternNode () const override; virtual XMLElementNode* createClipNode () const; virtual XMLElementNode* createGroupNode () const; virtual XMLElementNode* getGroupNode () const {return _groupNode;} @@ -84,12 +84,12 @@ class PSUncoloredTilingPattern : public PSTilingPattern public: PSUncoloredTilingPattern (int id, BoundingBox &bbox, Matrix &matrix, double xstep, double ystep); ~PSUncoloredTilingPattern (); - std::string svgID () const; + std::string svgID () const override; void setColor (Color color) {_currentColor = color;} - void apply (SpecialActions &actions); + void apply (SpecialActions &actions) override; protected: - XMLElementNode* createClipNode () const; + XMLElementNode* createClipNode () const override; private: std::set<Color> _colors; ///< colors this pattern has already been drawn with diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp index 78cdbb9a1ed..7ad11c04d6a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp @@ -2,7 +2,7 @@ ** PSPreviewFilter.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -20,11 +20,11 @@ #include <config.h> #include <vector> -#include "InputBuffer.h" -#include "InputReader.h" -#include "PSInterpreter.h" -#include "PSPreviewFilter.h" -#include "SpecialActions.h" +#include "InputBuffer.hpp" +#include "InputReader.hpp" +#include "PSInterpreter.hpp" +#include "PSPreviewFilter.hpp" +#include "SpecialActions.hpp" using namespace std; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.hpp index 89470250821..0479120391c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** PSPreviewFilter.h ** +** PSPreviewFilter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,13 +18,13 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_PSPREVIEWFILTER_H -#define DVISVGM_PSPREVIEWFILTER_H +#ifndef PSPREVIEWFILTER_HPP +#define PSPREVIEWFILTER_HPP #include <string> #include <vector> -#include "BoundingBox.h" -#include "PSFilter.h" +#include "BoundingBox.hpp" +#include "PSFilter.hpp" class SpecialActions; @@ -33,8 +33,8 @@ class PSPreviewFilter : public PSFilter public: PSPreviewFilter (PSInterpreter &psi); void activate (); - void execute (const char *code, size_t len); - bool active () const {return _active;} + void execute (const char *code, size_t len) override; + bool active () const override {return _active;} std::string version () const {return _version;} bool tightpage () const {return _tightpage;} void setDviScaleFactor (double dvi2bp) {_dvi2bp = dvi2bp;} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.cpp index 557a3cb441e..c2f3b4f3ad5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.cpp @@ -2,7 +2,7 @@ ** PageRanges.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -20,11 +20,9 @@ #include <config.h> #include <sstream> -#include "InputBuffer.h" -#include "InputReader.h" -#include "PageRanges.h" - -#include "macros.h" +#include "InputBuffer.hpp" +#include "InputReader.hpp" +#include "PageRanges.hpp" using namespace std; @@ -34,7 +32,7 @@ using namespace std; * @param[in] str string to parse * @param[in] max_page greatest allowed value * @return true on success; false denotes a syntax error */ -bool PageRanges::parse (string str, int max_page) { +bool PageRanges::parse (const string &str, int max_page) { StringInputBuffer ib(str); BufferInputReader ir(ib); while (ir) { diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.hpp index 130d354284a..61f04f7225a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** PageRanges.h ** +** PageRanges.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,18 +18,18 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_PAGERANGES_H -#define DVISVGM_PAGERANGES_H +#ifndef PAGERANGES_HPP +#define PAGERANGES_HPP #include <list> #include <string> #include <utility> -#include "NumericRanges.h" +#include "NumericRanges.hpp" class PageRanges : public NumericRanges<int> { public: - bool parse (std::string str, int max_page=0); + bool parse (const std::string &str, int max_page=0); size_t numberOfPages () const; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.cpp index a05209c8c17..a1a5dd41ce8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.cpp @@ -2,7 +2,7 @@ ** PageSize.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -23,16 +23,11 @@ #include <cctype> #include <cmath> #include <sstream> -#include "PageSize.h" +#include "PageSize.hpp" +#include "utility.hpp" using namespace std; -// make sure tolower is a function (and not a macro) -// so that 'transform' can be applied -static int my_tolower (int c) { - return tolower(c); -} - /** Computes width and height of ISO/DIN An in millimeters. * @param[in] n the A level (e.g. n=4 => DIN A4) @@ -86,7 +81,7 @@ static void computeDSize (int n, double &width, double &height) { /** Constructs a PageSize object of given size. * @param[in] name specifies the page size, e.g. "A4" or "letter" */ -PageSize::PageSize (string name) : _width(0), _height(0) { +PageSize::PageSize (const string &name) : _width(0), _height(0) { resize(name); } @@ -100,7 +95,7 @@ void PageSize::resize (string name) { if (name.length() < 2) throw PageSizeException("unknown page format: "+name); - transform(name.begin(), name.end(), name.begin(), my_tolower); + util::tolower(name); // extract optional suffix size_t pos = name.rfind("-"); bool landscape = false; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.hpp index 9ad113e4701..9c0dced9491 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** PageSize.h ** +** PageSize.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,10 +18,10 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_PAGESIZE_H -#define DVISVGM_PAGESIZE_H +#ifndef PAGESIZE_HPP +#define PAGESIZE_HPP -#include "MessageException.h" +#include "MessageException.hpp" struct PageSizeException : public MessageException { @@ -32,7 +32,7 @@ class PageSize { public: PageSize (double w=0, double h=0) : _width(w), _height(h) {} - PageSize (std::string name); + PageSize (const std::string &name); void resize (std:: string name); void resize (double w, double h); double widthInBP () const {return _width;} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Pair.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Pair.hpp index 7e235f28f31..c9058a3ff69 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Pair.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Pair.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** Pair.h ** +** Pair.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,13 +18,12 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_PAIR_H -#define DVISVGM_PAIR_H +#ifndef PAIR_HPP +#define PAIR_HPP #include <cmath> #include <ostream> -#include "macros.h" -#include "types.h" +#include "macros.hpp" template <typename T> class Pair @@ -50,12 +49,11 @@ class Pair }; -struct Pair32 : public Pair<Int32> +struct Pair32 : public Pair<int32_t> { - Pair32 (Int32 x=0, Int32 y=0) : Pair<Int32>(x, y) {} - explicit Pair32 (double x, double y) : Pair<Int32>(Int32(x+0.5), Int32(y+0.5)) {} - Pair32 (const Pair<Int32> &p) : Pair<Int32>(p) {} -// operator Pair<Int32> () {return *this;} + Pair32 (int32_t x=0, int32_t y=0) : Pair<int32_t>(x, y) {} + explicit Pair32 (double x, double y) : Pair<int32_t>(int32_t(x+0.5), int32_t(y+0.5)) {} + Pair32 (const Pair<int32_t> &p) : Pair<int32_t>(p) {} }; typedef Pair<double> DPair; @@ -75,5 +73,5 @@ IMPLEMENT_ARITHMETIC_OPERATOR2(Pair<T>, T, /) template <typename T> IMPLEMENT_OUTPUT_OPERATOR(Pair<T>) -IMPLEMENT_ARITHMETIC_OPERATOR2(Pair32, Int32, *) +IMPLEMENT_ARITHMETIC_OPERATOR2(Pair32, int32_t, *) #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.cpp index 23462182e6a..5777d1bb113 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.cpp @@ -1,7 +1,27 @@ -#include "Length.h" -#include "Message.h" -#include "PapersizeSpecialHandler.h" -#include "SpecialActions.h" +/************************************************************************* +** PapersizeSpecialHandler.cpp ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#include "Length.hpp" +#include "Message.hpp" +#include "PapersizeSpecialHandler.hpp" +#include "SpecialActions.hpp" using namespace std; @@ -24,7 +44,7 @@ void PapersizeSpecialHandler::preprocess (const char*, std::istream &is, Special if (!_pageSizes.empty() && _pageSizes.back().first == pageno) _pageSizes.back().second = whpair; else - _pageSizes.push_back(PageSize(pageno, whpair)); + _pageSizes.emplace_back(PageSize(pageno, whpair)); } } @@ -34,19 +54,17 @@ bool PapersizeSpecialHandler::process (const char *, std::istream &, SpecialActi } -bool PapersizeSpecialHandler::isLess (const PageSize &ps1, const PageSize &ps2) { - // order PageSize objects by page number - return ps1.first < ps2.first; -} - - void PapersizeSpecialHandler::dviEndPage (unsigned pageno, SpecialActions &actions) { if (actions.getBBoxFormatString() != "papersize") return; // find number of page with size change not lower than the current one typedef vector<PageSize>::iterator Iterator; - Iterator lb_it = lower_bound(_pageSizes.begin(), _pageSizes.end(), PageSize(pageno, DoublePair()), isLess); + Iterator lb_it = lower_bound(_pageSizes.begin(), _pageSizes.end(), PageSize(pageno, DoublePair()), + [](const PageSize &ps1, const PageSize &ps2) { + // order PageSize objects by page number + return ps1.first < ps2.first; + }); Iterator it = _pageSizes.end(); if (lb_it != _pageSizes.end() && lb_it->first == pageno) it = lb_it; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.h deleted file mode 100644 index e22f1612237..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef PAPERSIZESPECIALHANDLER_H -#define PAPERSIZESPECIALHANDLER_H - -#include <utility> -#include <vector> -#include "SpecialHandler.h" - -class PapersizeSpecialHandler : public SpecialHandler, public DVIEndPageListener { - typedef std::pair<double,double> DoublePair; - typedef std::pair<unsigned,DoublePair> PageSize; - - public: - void preprocess (const char *prefix, std::istream &is, SpecialActions &actions); - bool process (const char *prefix, std::istream &is, SpecialActions &actions); - const char* info () const {return "special to set the page size";} - const char* name () const {return "papersize";} - const char** prefixes () const; - - protected: - void dviEndPage (unsigned pageno, SpecialActions &actions); - static bool isLess (const PageSize &ps1, const PageSize &ps2); - - private: - std::vector<PageSize> _pageSizes; -}; - -#endif - diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.hpp new file mode 100644 index 00000000000..d43a404e841 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.hpp @@ -0,0 +1,48 @@ +/************************************************************************* +** PapersizeSpecialHandler.hpp ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef PAPERSIZESPECIALHANDLER_HPP +#define PAPERSIZESPECIALHANDLER_HPP + +#include <utility> +#include <vector> +#include "SpecialHandler.hpp" + +class PapersizeSpecialHandler : public SpecialHandler, public DVIEndPageListener { + typedef std::pair<double,double> DoublePair; + typedef std::pair<unsigned,DoublePair> PageSize; + + public: + void preprocess (const char *prefix, std::istream &is, SpecialActions &actions) override; + bool process (const char *prefix, std::istream &is, SpecialActions &actions) override; + const char* info () const override {return "special to set the page size";} + const char* name () const override {return "papersize";} + const char** prefixes () const override; + + protected: + void dviEndPage (unsigned pageno, SpecialActions &actions) override; + static bool isLess (const PageSize &ps1, const PageSize &ps2); + + private: + std::vector<PageSize> _pageSizes; +}; + +#endif + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.cpp index bd7e3dd5ac3..7fa21855b23 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.cpp @@ -2,7 +2,7 @@ ** PathClipper.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,9 +19,8 @@ *************************************************************************/ #include <config.h> -#include "Bezier.h" -#include "PathClipper.h" -#include "types.h" +#include "Bezier.hpp" +#include "PathClipper.hpp" using namespace std; using namespace ClipperLib; @@ -57,36 +56,36 @@ class FlattenActions : public CurvedPath::Actions { FlattenActions (vector<Bezier> &curves, Polygons &polygons, int &numLines) : _polygons(polygons), _curves(curves), _numLines(numLines) {} - void moveto (const CurvedPath::Point &p) { + void moveto (const CurvedPath::Point &p) override { if (p == _currentPoint && !_currentPoly.empty()) return; closepath(); - _currentPoly.push_back(IntPoint(to_cInt(p.x()), to_cInt(p.y()), 0)); + _currentPoly.emplace_back(IntPoint(to_cInt(p.x()), to_cInt(p.y()), 0)); _currentPoint = _startPoint = p; } - void lineto (const CurvedPath::Point &p) { + void lineto (const CurvedPath::Point &p) override { if (p == _currentPoint && !_currentPoly.empty()) return; if (_currentPoly.empty()) // this shouldn't happen but in case it does... - _currentPoly.push_back(IntPoint(0, 0, 0)); // ...add a start point first + _currentPoly.emplace_back(IntPoint(0, 0, 0)); // ...add a start point first _numLines--; _currentPoly.back().Z.label2 = _numLines; - _currentPoly.push_back(IntPoint(to_cInt(p.x()), to_cInt(p.y()), ZType(_numLines, 0))); + _currentPoly.emplace_back(IntPoint(to_cInt(p.x()), to_cInt(p.y()), ZType(_numLines, 0))); _currentPoint = p; } - void conicto (const CurvedPath::Point &p1, const CurvedPath::Point &p2) { + void conicto (const CurvedPath::Point &p1, const CurvedPath::Point &p2) override { Bezier bezier(_currentPoint, p1, p2); addCurvePoints(bezier); } - void cubicto (const CurvedPath::Point &p1, const CurvedPath::Point &p2, const CurvedPath::Point &p3) { + void cubicto (const CurvedPath::Point &p1, const CurvedPath::Point &p2, const CurvedPath::Point &p3) override { Bezier bezier(_currentPoint, p1, p2, p3); addCurvePoints(bezier); } - void closepath () { + void closepath () override { if (_currentPoly.empty()) return; _numLines--; @@ -96,14 +95,14 @@ class FlattenActions : public CurvedPath::Actions { _currentPoly.clear(); } - void finished () { + void finished () override { closepath(); } protected: void addCurvePoints (const Bezier &bezier) { if (_currentPoly.empty()) // this shouldn't happen but in case it does, ... - _currentPoly.push_back(IntPoint(0, 0, 0)); // ...add a start point first + _currentPoly.emplace_back(IntPoint(0, 0, 0)); // ...add a start point first vector<DPair> points; // points of flattened curve vector<double> t; // corresponding 'time' parameters bezier.approximate(0.01, points, &t); @@ -116,7 +115,7 @@ class FlattenActions : public CurvedPath::Actions { continue; _currentPoly.back().Z.label2 = ZLabel(_curves.size(), t[i-1]); ZLabel label(_curves.size(), t[i]); - _currentPoly.push_back(IntPoint(to_cInt(p.x()), to_cInt(p.y()), ZType(label, label))); + _currentPoly.emplace_back(IntPoint(to_cInt(p.x()), to_cInt(p.y()), ZType(label, label))); _currentPoint = p; } } @@ -177,10 +176,10 @@ void PathClipper::flatten (const CurvedPath &curvedPath, Polygons &polygons) { * edge belongs to. * @param[in] p1 first of two adjacent vertices * @param[in] p2 second of two adjacent vertices - * @param[out] t1 time paramater of p1 - * @param[out] t2 time paramater of p2 + * @param[out] t1 time parameter of p1 + * @param[out] t2 time parameter of p2 * @return id of edge between p1 and p2, or 0 if it's not possible to identify the segment */ -static Int32 segment_id (const IntPoint &p1, const IntPoint &p2, double &t1, double &t2) { +static int32_t segment_id (const IntPoint &p1, const IntPoint &p2, double &t1, double &t2) { const ZType &z1=p1.Z, &z2=p2.Z; if (z1 == z2 && z1.minLabel().id < 0) return z1.minLabel().id; if (z1.label1 == z2.label2) {t1=z1.label1.t; t2=z2.label2.t; return z1.label1.id;} @@ -193,13 +192,13 @@ static Int32 segment_id (const IntPoint &p1, const IntPoint &p2, double &t1, dou } -inline Int32 edge_id (const IntPoint &p1, const IntPoint &p2) { - double t; +inline int32_t edge_id (const IntPoint &p1, const IntPoint &p2) { + double t=0; return segment_id(p1, p2, t, t); } -/** This function expects 3 colinear points p1, p2, and q where q lies between p1 and p2, +/** This function expects 3 colinear points p1, p2, and q, where q lies between p1 and p2, * i.e. q divides the line \f$ \overline{p_1 p_2} \f$ somewhere. The function returns * the corresponding division ratio. */ static double division_ratio (const IntPoint &p1, const IntPoint &p2, const IntPoint &q) { @@ -217,7 +216,7 @@ static double division_ratio (const IntPoint &p1, const IntPoint &p2, const IntP inline ZLabel division_label (const IntPoint &p1, const IntPoint &p2, const IntPoint &q) { double t1, t2; double s=0; - Int32 id = segment_id(p1, p2, t1, t2); + int32_t id = segment_id(p1, p2, t1, t2); if (id > 0) s = t1+(t2-t1)*division_ratio(p1, p2, q); return ZLabel(id, s); @@ -251,9 +250,9 @@ static size_t find_segment_endpoint (const Polygon &polygon, size_t start, ZLabe const size_t num_points = polygon.size(); int i = start%num_points; - double t1, t2; // time parameters of start and endpoint of current edge - Int32 id1 = segment_id(polygon[i], polygon[(i+1)%num_points], t1, t2); - Int32 id2 = id1; + double t1=0, t2=0; // time parameters of start and endpoint of current edge + int32_t id1 = segment_id(polygon[i], polygon[(i+1)%num_points], t1, t2); + int32_t id2 = id1; double t = t2; // time parameter of resulting endpoint for (size_t j=1; id1 == id2 && j < num_points; j++) { t = t2; @@ -275,8 +274,8 @@ static size_t find_segment_endpoint (const Polygon &polygon, size_t start, ZLabe * @param[in] polygons set of polygons to reconstruct * @param[out] path the reconstructed curved path */ void PathClipper::reconstruct (const Polygons &polygons, CurvedPath &path) { - for (size_t i=0; i < polygons.size(); i++) - reconstruct(polygons[i], path); + for (const Polygon &polygon : polygons) + reconstruct(polygon, path); } @@ -315,11 +314,11 @@ void PathClipper::reconstruct (const Polygon &polygon, CurvedPath &path) { inline PolyFillType polyFillType (CurvedPath::WindingRule wr) { - return (wr == CurvedPath::WR_NON_ZERO) ? pftNonZero : pftEvenOdd; + return (wr == CurvedPath::WindingRule::NON_ZERO) ? pftNonZero : pftEvenOdd; } -/** Computes the intersection of to curved path. +/** Computes the intersection of to curved paths. * @param[in] p1 first curved path * @param[in] p2 second curved path * @param[out] result intersection of p1 and p2 */ diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.hpp index d04373c9415..b265c9de0cf 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** PathClipper.h ** +** PathClipper.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,15 +18,15 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_PATHCLIPPER_H -#define DVISVGM_PATHCLIPPER_H +#ifndef PATHCLIPPER_HPP +#define PATHCLIPPER_HPP #include <clipper.hpp> #include <string> #include <vector> -#include "Bezier.h" -#include "GraphicsPath.h" -#include "MessageException.h" +#include "Bezier.hpp" +#include "GraphicsPath.hpp" +#include "MessageException.hpp" using ClipperLib::IntPoint; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.cpp index d55e95a9247..f5e6026bc99 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.cpp @@ -2,7 +2,7 @@ ** PdfSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -20,11 +20,11 @@ #include <config.h> #include <cstring> -#include "InputReader.h" -#include "MapLine.h" -#include "PdfSpecialHandler.h" -#include "FontMap.h" -#include "Message.h" +#include "InputReader.hpp" +#include "MapLine.hpp" +#include "PdfSpecialHandler.hpp" +#include "FontMap.hpp" +#include "Message.hpp" using namespace std; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.hpp index 0608f347a89..cca0d07fc83 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** PdfSpecialHandler.h ** +** PdfSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,19 +18,19 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_PDFSPECIALHANDLER_H -#define DVISVGM_PDFSPECIALHANDLER_H +#ifndef PDFSPECIALHANDLER_HPP +#define PDFSPECIALHANDLER_HPP -#include "SpecialHandler.h" +#include "SpecialHandler.hpp" class PdfSpecialHandler : public SpecialHandler { public: PdfSpecialHandler (); - const char* info () const {return "pdfTeX font map specials";} - const char* name () const {return "pdf";} - const char** prefixes () const; - bool process (const char *prefix, std::istream &is, SpecialActions &actions); + const char* info () const override {return "pdfTeX font map specials";} + const char* name () const override {return "pdf";} + const char** prefixes () const override; + bool process (const char *prefix, std::istream &is, SpecialActions &actions) override; private: bool _maplineProcessed; ///< true if a mapline or mapfile special has already been processed diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.cpp index f3a6e6aeb17..0f831439c60 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.cpp @@ -2,7 +2,7 @@ ** PreScanDVIReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,8 +18,8 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#include "DVIActions.h" -#include "PreScanDVIReader.h" +#include "DVIActions.hpp" +#include "PreScanDVIReader.hpp" using namespace std; @@ -37,7 +37,7 @@ void PreScanDVIReader::cmdBop (int) { void PreScanDVIReader::cmdXXX (int len) { - UInt32 numBytes = readUnsigned(len); + uint32_t numBytes = readUnsigned(len); string s = readString(numBytes); if (_actions) _actions->special(s, 0, true); // pre-process special diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.hpp index c54cbe10fe9..b543490c8a4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** PreScanDVIReader.h ** +** PreScanDVIReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,10 +18,10 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef PRESCANDVIREADER_H -#define PRESCANDVIREADER_H +#ifndef PRESCANDVIREADER_HPP +#define PRESCANDVIREADER_HPP -#include "BasicDVIReader.h" +#include "BasicDVIReader.hpp" struct DVIActions; @@ -29,11 +29,11 @@ class PreScanDVIReader : public BasicDVIReader { public: PreScanDVIReader (std::istream &is, DVIActions *actions); - unsigned currentPageNumber () const {return _currentPageNumber;} + unsigned currentPageNumber () const override {return _currentPageNumber;} protected: - void cmdBop (int); - void cmdXXX (int len); + void cmdBop (int) override; + void cmdXXX (int len) override; private: DVIActions *_actions; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.cpp index 753ebfec253..16c2d41b3c4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.cpp @@ -2,7 +2,7 @@ ** Process.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -30,10 +30,9 @@ #endif #include <cstdlib> -#include "FileSystem.h" -#include "Process.h" -#include "SignalHandler.h" -#include "macros.h" +#include "FileSystem.hpp" +#include "Process.hpp" +#include "SignalHandler.hpp" using namespace std; @@ -201,3 +200,18 @@ bool Process::run (string *out) { #endif } + +/** Runs the process in the given working directory and waits until it's finished. + * @param[in] dir working directory + * @param[out] out takes the output written to stdout by the executed process + * @return true if process terminated properly + * @throw SignalException if CTRL-C was pressed during execution */ +bool Process::run (const string &dir, string *out) { + bool ret = false; + string cwd = FileSystem::getcwd(); + if (FileSystem::chdir(dir)) { + ret = run(out); + ret &= FileSystem::chdir(cwd); + } + return ret; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.hpp index 4cb4c757c00..b45bdfe1fe4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** Process.h ** +** Process.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,8 +18,8 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_PROCESS_H -#define DVISVGM_PROCESS_H +#ifndef PROCESS_HPP +#define PROCESS_HPP #include <string> @@ -28,9 +28,10 @@ class Process public: Process (const std::string &cmd, const std::string ¶mstr); bool run (std::string *out=0); + bool run (const std::string &dir, std::string *out=0); protected: - Process (const Process& orig) {} + Process (const Process &orig) =default; private: std::string _cmd; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp index d4bee4a600b..9c60546bc0f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp @@ -2,7 +2,7 @@ ** PsSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -23,17 +23,17 @@ #include <fstream> #include <memory> #include <sstream> -#include "EPSFile.h" -#include "FileFinder.h" -#include "Message.h" -#include "PathClipper.h" -#include "PSPattern.h" -#include "PSPreviewFilter.h" -#include "PsSpecialHandler.h" -#include "SpecialActions.h" -#include "SVGTree.h" -#include "TensorProductPatch.h" -#include "TriangularPatch.h" +#include "EPSFile.hpp" +#include "FileFinder.hpp" +#include "Message.hpp" +#include "PathClipper.hpp" +#include "PSPattern.hpp" +#include "PSPreviewFilter.hpp" +#include "PsSpecialHandler.hpp" +#include "SpecialActions.hpp" +#include "SVGTree.hpp" +#include "TensorProductPatch.hpp" +#include "TriangularPatch.hpp" using namespace std; @@ -60,8 +60,8 @@ PsSpecialHandler::PsSpecialHandler () : _psi(this), _actions(0), _previewFilter( PsSpecialHandler::~PsSpecialHandler () { _psi.setActions(0); // ensure no further PS actions are performed - for (map<int, PSPattern*>::iterator it=_patterns.begin(); it != _patterns.end(); ++it) - delete it->second; + for (auto &entry : _patterns) + delete entry.second; } @@ -76,7 +76,7 @@ void PsSpecialHandler::initialize () { for (const char **p=headers; *p; ++p) processHeaderFile(*p); // disable bop/eop operators to prevent side-effects by - // unexpected bobs/eops present in PS specials + // unexpected bops/eops present in PS specials _psi.execute("\nTeXDict begin /bop{pop pop}def /eop{}def end "); _psSection = PS_HEADERS; // allow to process header specials now } @@ -101,7 +101,7 @@ void PsSpecialHandler::initgraphics () { void PsSpecialHandler::processHeaderFile (const char *name) { - if (const char *path = FileFinder::lookup(name, false)) { + if (const char *path = FileFinder::instance().lookup(name, false)) { ifstream ifs(path); _psi.execute(string("%%BeginProcSet: ")+name+" 0 0\n", false); _psi.execute(ifs, false); @@ -772,7 +772,7 @@ void PsSpecialHandler::clip (Path &path, bool evenodd) { if (path.empty() || !_actions) return; - Path::WindingRule windingRule = evenodd ? Path::WR_EVEN_ODD : Path::WR_NON_ZERO; + Path::WindingRule windingRule = evenodd ? Path::WindingRule::EVEN_ODD : Path::WindingRule::NON_ZERO; path.setWindingRule(windingRule); if (!_actions->getMatrix().isIdentity()) @@ -824,11 +824,11 @@ void PsSpecialHandler::shfill (vector<double> ¶ms) { // collect common data relevant for all shading types int shadingTypeID = static_cast<int>(params[0]); - ColorSpace colorSpace = Color::RGB_SPACE; + ColorSpace colorSpace = Color::ColorSpace::RGB; switch (static_cast<int>(params[1])) { - case 1: colorSpace = Color::GRAY_SPACE; break; - case 3: colorSpace = Color::RGB_SPACE; break; - case 4: colorSpace = Color::CMYK_SPACE; break; + case 1: colorSpace = Color::ColorSpace::GRAY; break; + case 3: colorSpace = Color::ColorSpace::RGB; break; + case 4: colorSpace = Color::ColorSpace::CMYK; break; } VectorIterator<double> it = params; it += 2; // skip shading type and color space @@ -928,7 +928,7 @@ class ShadingCallback : public ShadingPatch::Callback { _group->addAttribute("clip-path", XMLString("url(#clip")+XMLString(clippathID)+")"); } - void patchSegment (GraphicsPath<double> &path, const Color &color) { + void patchSegment (GraphicsPath<double> &path, const Color &color) override { if (!_actions.getMatrix().isIdentity()) path.transform(_actions.getMatrix()); @@ -950,14 +950,14 @@ class ShadingCallback : public ShadingPatch::Callback { /** Handle all patch meshes whose patches and their connections can be processed sequentially. * This comprises free-form triangular, Coons, and tensor-product patch meshes. */ void PsSpecialHandler::processSequentialPatchMesh (int shadingTypeID, ColorSpace colorSpace, VectorIterator<double> &it) { - auto_ptr<ShadingPatch> previousPatch; + unique_ptr<ShadingPatch> previousPatch; while (it.valid()) { int edgeflag = static_cast<int>(*it++); vector<DPair> points; vector<Color> colors; - auto_ptr<ShadingPatch> patch; + unique_ptr<ShadingPatch> patch; - patch = auto_ptr<ShadingPatch>(ShadingPatch::create(shadingTypeID, colorSpace)); + patch = unique_ptr<ShadingPatch>(ShadingPatch::create(shadingTypeID, colorSpace)); read_patch_data(*patch, edgeflag, it, points, colors); patch->setPoints(points, edgeflag, previousPatch.get()); patch->setColors(colors, edgeflag, previousPatch.get()); @@ -978,7 +978,7 @@ void PsSpecialHandler::processSequentialPatchMesh (int shadingTypeID, ColorSpace bbox.transform(_actions->getMatrix()); _actions->embed(bbox); } - previousPatch = patch; + previousPatch = std::move(patch); } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp index 7c2f79009be..fe95443215b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** PsSpecialHandler.h ** +** PsSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,18 +18,18 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_PSSPECIALHANDLER_H -#define DVISVGM_PSSPECIALHANDLER_H +#ifndef PSSPECIALHANDLER_HPP +#define PSSPECIALHANDLER_HPP #include <set> #include <stack> #include <string> #include <vector> -#include "GraphicsPath.h" -#include "PSInterpreter.h" -#include "SpecialHandler.h" -#include "PSPattern.h" -#include "PSPreviewFilter.h" +#include "GraphicsPath.hpp" +#include "PSInterpreter.hpp" +#include "SpecialHandler.hpp" +#include "PSPattern.hpp" +#include "PSPreviewFilter.hpp" class PSPattern; @@ -55,7 +55,7 @@ class PsSpecialHandler : public SpecialHandler, public DVIEndPageListener, prote void setClippathLoaded (bool loaded); const Path* top () const; Path* getPath (size_t id); - int topID () const {return _stack.empty() ? 0 : _stack.top().pathID;} + int topID () const {return _stack.empty() ? 0 : _stack.top().pathID;} private: struct Entry { @@ -73,12 +73,12 @@ class PsSpecialHandler : public SpecialHandler, public DVIEndPageListener, prote public: PsSpecialHandler (); ~PsSpecialHandler (); - const char* name () const {return "ps";} - const char* info () const {return "dvips PostScript specials";} - const char** prefixes () const; - void preprocess (const char *prefix, std::istream &is, SpecialActions &actions); - bool process (const char *prefix, std::istream &is, SpecialActions &actions); - void setDviScaleFactor (double dvi2bp) {_previewFilter.setDviScaleFactor(dvi2bp);} + const char* name () const override {return "ps";} + const char* info () const override {return "dvips PostScript specials";} + const char** prefixes () const override; + void preprocess (const char *prefix, std::istream &is, SpecialActions &actions) override; + bool process (const char *prefix, std::istream &is, SpecialActions &actions) override; + void setDviScaleFactor (double dvi2bp) override {_previewFilter.setDviScaleFactor(dvi2bp);} void enterBodySection (); public: @@ -94,7 +94,7 @@ class PsSpecialHandler : public SpecialHandler, public DVIEndPageListener, prote void executeAndSync (std::istream &is, bool updatePos); void processHeaderFile (const char *fname); void psfile (const std::string &fname, const std::map<std::string,std::string> &attr); - void dviEndPage (unsigned pageno, SpecialActions &actions); + void dviEndPage (unsigned pageno, SpecialActions &actions) override; void clip (Path &path, bool evenodd); void processSequentialPatchMesh (int shadingTypeID, ColorSpace cspace, VectorIterator<double> &it); void processLatticeTriangularPatchMesh (ColorSpace colorSpace, VectorIterator<double> &it); @@ -102,45 +102,45 @@ class PsSpecialHandler : public SpecialHandler, public DVIEndPageListener, prote /// scale given value by current PS scale factors double scale (double v) const {return v*(_sx*_cos*_cos + _sy*(1-_cos*_cos));} - void applyscalevals (std::vector<double> &p) {_sx = p[0]; _sy = p[1]; _cos = p[2];} - void clip (std::vector<double> &p) {clip(p, false);} + void applyscalevals (std::vector<double> &p) override {_sx = p[0]; _sy = p[1]; _cos = p[2];} + void clip (std::vector<double> &p) override {clip(p, false);} void clip (std::vector<double> &p, bool evenodd); - void clippath (std::vector<double> &p); - void closepath (std::vector<double> &p); - void curveto (std::vector<double> &p); - void eoclip (std::vector<double> &p) {clip(p, true);} - void eofill (std::vector<double> &p) {fill(p, true);} + void clippath (std::vector<double> &p) override; + void closepath (std::vector<double> &p) override; + void curveto (std::vector<double> &p) override; + void eoclip (std::vector<double> &p) override {clip(p, true);} + void eofill (std::vector<double> &p) override {fill(p, true);} void fill (std::vector<double> &p, bool evenodd); - void fill (std::vector<double> &p) {fill(p, false);} - void grestore (std::vector<double> &p); - void grestoreall (std::vector<double> &p); - void gsave (std::vector<double> &p); - void initclip (std::vector<double> &p); - void lineto (std::vector<double> &p); - void makepattern (std::vector<double> &p); - void moveto (std::vector<double> &p); - void newpath (std::vector<double> &p); - void querypos (std::vector<double> &p) {_currentpoint = DPair(p[0], p[1]);} - void restore (std::vector<double> &p); - void rotate (std::vector<double> &p); - void save (std::vector<double> &p); - void scale (std::vector<double> &p); - void setcmykcolor (std::vector<double> &cmyk); - void setdash (std::vector<double> &p); - void setgray (std::vector<double> &p); - void sethsbcolor (std::vector<double> &hsb); - void setlinecap (std::vector<double> &p) {_linecap = UInt8(p[0]);} - void setlinejoin (std::vector<double> &p) {_linejoin = UInt8(p[0]);} - void setlinewidth (std::vector<double> &p) {_linewidth = p[0] ? scale(p[0])*1.00375 : 0.5;} - void setmatrix (std::vector<double> &p); - void setmiterlimit (std::vector<double> &p) {_miterlimit = p[0]*1.00375;} - void setopacityalpha (std::vector<double> &p){_opacityalpha = p[0];} - void setpattern (std::vector<double> &p); - void setrgbcolor (std::vector<double> &rgb); - void shfill (std::vector<double> &p); - void stroke (std::vector<double> &p); - void translate (std::vector<double> &p); - void executed (); + void fill (std::vector<double> &p) override {fill(p, false);} + void grestore (std::vector<double> &p) override; + void grestoreall (std::vector<double> &p) override; + void gsave (std::vector<double> &p) override; + void initclip (std::vector<double> &p) override; + void lineto (std::vector<double> &p) override; + void makepattern (std::vector<double> &p) override; + void moveto (std::vector<double> &p) override; + void newpath (std::vector<double> &p) override; + void querypos (std::vector<double> &p) override {_currentpoint = DPair(p[0], p[1]);} + void restore (std::vector<double> &p) override; + void rotate (std::vector<double> &p) override; + void save (std::vector<double> &p) override; + void scale (std::vector<double> &p) override; + void setcmykcolor (std::vector<double> &cmyk) override; + void setdash (std::vector<double> &p) override; + void setgray (std::vector<double> &p) override; + void sethsbcolor (std::vector<double> &hsb) override; + void setlinecap (std::vector<double> &p) override {_linecap = uint8_t(p[0]);} + void setlinejoin (std::vector<double> &p) override {_linejoin = uint8_t(p[0]);} + void setlinewidth (std::vector<double> &p) override {_linewidth = p[0] ? scale(p[0])*1.00375 : 0.5;} + void setmatrix (std::vector<double> &p) override; + void setmiterlimit (std::vector<double> &p) override {_miterlimit = p[0]*1.00375;} + void setopacityalpha (std::vector<double> &p) override {_opacityalpha = p[0];} + void setpattern (std::vector<double> &p) override; + void setrgbcolor (std::vector<double> &rgb) override; + void shfill (std::vector<double> &p) override; + void stroke (std::vector<double> &p) override; + void translate (std::vector<double> &p) override; + void executed () override; private: PSInterpreter _psi; @@ -158,8 +158,8 @@ class PsSpecialHandler : public SpecialHandler, public DVIEndPageListener, prote double _linewidth; ///< current linewidth double _miterlimit; ///< current miter limit double _opacityalpha; ///< opacity level (0=fully transparent, ..., 1=opaque) - UInt8 _linecap : 2; ///< current line cap (0=butt, 1=round, 2=projecting square) - UInt8 _linejoin : 2; ///< current line join (0=miter, 1=round, 2=bevel) + uint8_t _linecap : 2; ///< current line cap (0=butt, 1=round, 2=projecting square) + uint8_t _linejoin : 2; ///< current line join (0=miter, 1=round, 2=bevel) double _dashoffset; ///< current dash offset std::vector<double> _dashpattern; ClippingStack _clipStack; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp index 7066e62bef1..ac2097624f7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp @@ -2,7 +2,7 @@ ** RangeMap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,7 +18,7 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#include "RangeMap.h" +#include "RangeMap.hpp" using namespace std; @@ -75,24 +75,24 @@ bool RangeMap::Range::join (const Range &r) { * @param[in] cmin smallest number in the range * @param[in] cmax largest number in the range * @param[in] vmin map value of cmin */ -void RangeMap::addRange (UInt32 cmin, UInt32 cmax, UInt32 vmin) { +void RangeMap::addRange (uint32_t cmin, uint32_t cmax, uint32_t vmin) { if (cmin > cmax) swap(cmin, cmax); Range range(cmin, cmax, vmin); if (_ranges.empty()) - _ranges.push_back(range); + _ranges.emplace_back(std::move(range)); else { // check for simple cases that can be handled pretty fast Range &lrange = *_ranges.begin(); Range &rrange = *_ranges.rbegin(); if (cmin > rrange.max()) { // non-overlapping range at end of vector? if (!rrange.join(range)) - _ranges.push_back(range); + _ranges.emplace_back(std::move(range)); } else if (cmax < lrange.min()) { // non-overlapping range at begin of vector? if (!lrange.join(range)) - _ranges.insert(_ranges.begin(), range); + _ranges.emplace(_ranges.begin(), std::move(range)); } else { // ranges overlap and/or must be inserted somewhere inside the vector @@ -103,13 +103,13 @@ void RangeMap::addRange (UInt32 cmin, UInt32 cmax, UInt32 vmin) { if (!it->join(range) && (it == _ranges.begin() || !(it-1)->join(range))) { if (it->min() < cmin && it->max() > cmax) { // new range completely inside an existing range? //split existing range - UInt32 itmax = it->max(); + uint32_t itmax = it->max(); it->max(cmin-1); - it = _ranges.insert(it+1, Range(cmax+1, itmax, it->valueAt(cmax+1))); + it = _ranges.emplace(it+1, Range(cmax+1, itmax, it->valueAt(cmax+1))); } else if (at_end) // does new range overlap right side of last range in vector? it = _ranges.end(); // => append new range at end of vector - it = _ranges.insert(it, range); + it = _ranges.emplace(it, std::move(range)); } adaptNeighbors(it); // resolve overlaps } @@ -125,11 +125,11 @@ void RangeMap::addRange (UInt32 cmin, UInt32 cmax, UInt32 vmin) { void RangeMap::adaptNeighbors (Ranges::iterator it) { if (it != _ranges.end()) { // adapt left neighbor - Ranges::iterator lit = it-1; // points to left neighbor - if (it != _ranges.begin() && it->min() <= lit->max()) { + if (it != _ranges.begin() && it->min() <= (it-1)->max()) { + Ranges::iterator lit = it-1; // points to left neighbor bool left_neighbor_valid = (it->min() > 0 && it->min()-1 >= lit->min()); - if (left_neighbor_valid) // is adapted left neighbor valid? - lit->max(it->min()-1); // => assign new max value + if (left_neighbor_valid) // is adapted left neighbor valid? + lit->max(it->min()-1); // => assign new max value if (!left_neighbor_valid || it->join(*lit)) it = _ranges.erase(lit); } @@ -154,7 +154,7 @@ void RangeMap::adaptNeighbors (Ranges::iterator it) { /** Finds the index of the range that contains a given value c. * @param[in] c find range that contains this value * @return index of the range found, or -1 if range was not found */ -int RangeMap::lookup (UInt32 c) const { +int RangeMap::lookup (uint32_t c) const { // simple binary search int left=0, right=_ranges.size()-1; while (left <= right) { @@ -170,7 +170,7 @@ int RangeMap::lookup (UInt32 c) const { } -UInt32 RangeMap::valueAt (UInt32 c) const { +uint32_t RangeMap::valueAt (uint32_t c) const { int pos = lookup(c); return pos < 0 ? 0 : _ranges[pos].valueAt(c); } @@ -185,4 +185,4 @@ ostream& RangeMap::write (ostream& os) const { for (size_t i=0; i < _ranges.size(); i++) _ranges[i].write(os) << '\n'; return os; -}
\ No newline at end of file +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.hpp index 03d31951492..6170a2aa5dc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** RangeMap.h ** +** RangeMap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,13 +18,12 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_RANGEMAP_H -#define DVISVGM_RANGEMAP_H +#ifndef RANGEMAP_HPP +#define RANGEMAP_HPP #include <algorithm> #include <ostream> #include <vector> -#include "types.h" class RangeMap { @@ -35,45 +34,45 @@ class RangeMap { public: Range () : _min(0), _max(0), _minval(0) {} - Range (UInt32 min, UInt32 max, UInt32 minval) : _min(min), _max(max), _minval(minval) { + Range (uint32_t min, uint32_t max, uint32_t minval) : _min(min), _max(max), _minval(minval) { if (_min > _max) std::swap(_min, _max); } - UInt32 min () const {return _min;} - UInt32 max () const {return _max;} - UInt32 minval () const {return _minval;} - UInt32 maxval () const {return valueAt(_max);} - UInt32 valueAt (UInt32 c) const {return c-_min+_minval;} + uint32_t min () const {return _min;} + uint32_t max () const {return _max;} + uint32_t minval () const {return _minval;} + uint32_t maxval () const {return valueAt(_max);} + uint32_t valueAt (uint32_t c) const {return c-_min+_minval;} bool operator < (const Range &r) const {return _min < r._min;} std::ostream& write (std::ostream &os) const; protected: - void min (UInt32 m) {_min = m;} - void max (UInt32 m) {_max = m;} - void setMinAndAdaptValue (UInt32 c) {_minval = valueAt(c); _min = c;} + void min (uint32_t m) {_min = m;} + void max (uint32_t m) {_max = m;} + void setMinAndAdaptValue (uint32_t c) {_minval = valueAt(c); _min = c;} bool join (const Range &r); private: - UInt32 _min, _max; - UInt32 _minval; + uint32_t _min, _max; + uint32_t _minval; }; typedef std::vector<Range> Ranges; public: - void addRange (UInt32 first, UInt32 last, UInt32 cid); - bool valueExists (UInt32 c) const {return lookup(c) >= 0;} - UInt32 valueAt (UInt32 c) const; - size_t size () const {return _ranges.size();} - bool empty () const {return _ranges.empty();} - void clear () {_ranges.clear();} + void addRange (uint32_t first, uint32_t last, uint32_t cid); + bool valueExists (uint32_t c) const {return lookup(c) >= 0;} + uint32_t valueAt (uint32_t c) const; + size_t size () const {return _ranges.size();} + bool empty () const {return _ranges.empty();} + void clear () {_ranges.clear();} std::ostream& write (std::ostream &os) const; protected: void adaptNeighbors (Ranges::iterator it); - int lookup (UInt32 c) const; - const Range& rangeAt (size_t n) const {return _ranges[n];} + int lookup (uint32_t c) const; + const Range& rangeAt (size_t n) const {return _ranges[n];} private: Ranges _ranges; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.cpp index 98fd59f1523..50215d936dc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.cpp @@ -2,7 +2,7 @@ ** SVGCharHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,8 +18,8 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#include "SVGCharHandler.h" -#include "XMLNode.h" +#include "SVGCharHandler.hpp" +#include "XMLNode.hpp" using namespace std; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.hpp index 9b222f7c10d..5bcd92a685a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** SVGCharHandler.h ** +** SVGCharHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,14 +18,13 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef SVGCHARHANDLER_H -#define SVGCHARHANDLER_H +#ifndef SVGCHARHANDLER_HPP +#define SVGCHARHANDLER_HPP #include <stack> -#include "Color.h" -#include "Font.h" -#include "Matrix.h" -#include "types.h" +#include "Color.hpp" +#include "Font.hpp" +#include "Matrix.hpp" template <typename T> @@ -59,9 +58,9 @@ class XMLElementNode; class SVGCharHandler { public: SVGCharHandler () : _color(Color::BLACK), _font(0), _fontnum(0), _matrix(1), _vertical(false), _initialContextNode(0) {} - virtual ~SVGCharHandler() {} + virtual ~SVGCharHandler() =default; virtual void setInitialContextNode (XMLElementNode *node); - virtual void appendChar (UInt32 c, double x, double y) =0; + virtual void appendChar (uint32_t c, double x, double y) =0; virtual void notifyXAdjusted () {} virtual void notifyYAdjusted () {} void setColor (const Color &color) {_color.set(color);} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.cpp index 2f7b8b219e6..820850a161c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.cpp @@ -2,7 +2,7 @@ ** SVGCharHandlerFactory.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,11 +18,11 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#include "SVGCharHandlerFactory.h" -#include "SVGCharPathHandler.h" -#include "SVGSingleCharTextHandler.h" -#include "SVGCharTspanTextHandler.h" -#include "SVGTree.h" +#include "SVGCharHandlerFactory.hpp" +#include "SVGCharPathHandler.hpp" +#include "SVGSingleCharTextHandler.hpp" +#include "SVGCharTspanTextHandler.hpp" +#include "SVGTree.hpp" SVGCharHandler* SVGCharHandlerFactory::createHandler () { diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.hpp index 9fc3199b185..4000bd76634 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** SVGCharHandlerFactory.h ** +** SVGCharHandlerFactory.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,10 +18,10 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef SVGCHARHANDLERFACTORY_H -#define SVGCHARHANDLERFACTORY_H +#ifndef SVGCHARHANDLERFACTORY_HPP +#define SVGCHARHANDLERFACTORY_HPP -#include "SVGCharHandler.h" +#include "SVGCharHandler.hpp" struct SVGCharHandlerFactory diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.cpp index 5793cf389bc..db6c2aba999 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.cpp @@ -2,7 +2,7 @@ ** SVGCharPathHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,10 +19,10 @@ *************************************************************************/ #include <sstream> -#include "Font.h" -#include "FontManager.h" -#include "SVGCharPathHandler.h" -#include "XMLNode.h" +#include "Font.hpp" +#include "FontManager.hpp" +#include "SVGCharPathHandler.hpp" +#include "XMLNode.hpp" using namespace std; @@ -49,7 +49,7 @@ void SVGCharPathHandler::resetContextNode () { * @param[in] c code of the character to be appended * @param[in] x horizontal position of the character (in bp units) * @param[in] y vertical position of the character (in bp units) */ -void SVGCharPathHandler::appendChar (UInt32 c, double x, double y) { +void SVGCharPathHandler::appendChar (uint32_t c, double x, double y) { if (_font.changed()) { _fontColor.set(_font.get()->color()); if (_fontColor.changed() && _fontColor.get() != Color::BLACK) @@ -107,7 +107,7 @@ void SVGCharPathHandler::appendChar (UInt32 c, double x, double y) { } -void SVGCharPathHandler::appendUseElement (UInt32 c, double x, double y, const Matrix &matrix) { +void SVGCharPathHandler::appendUseElement (uint32_t c, double x, double y, const Matrix &matrix) { ostringstream oss; oss << "#g" << FontManager::instance().fontID(_font) << '-' << c; XMLElementNode *useNode = new XMLElementNode("use"); @@ -120,7 +120,7 @@ void SVGCharPathHandler::appendUseElement (UInt32 c, double x, double y, const M } -void SVGCharPathHandler::appendPathElement (UInt32 c, double x, double y, const Matrix &matrix) { +void SVGCharPathHandler::appendPathElement (uint32_t c, double x, double y, const Matrix &matrix) { Glyph glyph; const PhysicalFont *pf = dynamic_cast<const PhysicalFont*>(_font.get()); if (pf && pf->getGlyph(c, glyph)) { diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.hpp index 0acd9693a1f..2031c6c472f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** SVGCharPathHandler.h ** +** SVGCharPathHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,23 +18,23 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef SVGCHARPATHHANDLER_H -#define SVGCHARPATHHANDLER_H +#ifndef SVGCHARPATHHANDLER_HPP +#define SVGCHARPATHHANDLER_HPP -#include "SVGCharHandler.h" +#include "SVGCharHandler.hpp" /** Creates SVG path elements for all characters. */ class SVGCharPathHandler : public SVGCharHandler { - typedef void (SVGCharPathHandler::*AppendMethod)(UInt32 c, double x, double y, const Matrix &matrix); + typedef void (SVGCharPathHandler::*AppendMethod)(uint32_t c, double x, double y, const Matrix &matrix); public: SVGCharPathHandler (bool createUseElements, bool relativePathsCommands); - void appendChar (UInt32 c, double x, double y); + void appendChar (uint32_t c, double x, double y) override; protected: - void appendUseElement (UInt32 c, double x, double y, const Matrix &matrix); - void appendPathElement (UInt32 c, double x, double y, const Matrix &matrix); - void resetContextNode (); + void appendUseElement (uint32_t c, double x, double y, const Matrix &matrix); + void appendPathElement (uint32_t c, double x, double y, const Matrix &matrix); + void resetContextNode () override; private: AppendMethod _appendChar; ///< method called to append a single character diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.cpp index 0153bacd05d..d9432971180 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.cpp @@ -2,7 +2,7 @@ ** SVGCharTspanTextHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,8 +18,8 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#include "SVGCharTspanTextHandler.h" -#include "XMLNode.h" +#include "SVGCharTspanTextHandler.hpp" +#include "XMLNode.hpp" using namespace std; @@ -30,7 +30,7 @@ SVGCharTspanTextHandler::SVGCharTspanTextHandler (bool selectFontByClass) } -void SVGCharTspanTextHandler::appendChar (UInt32 c, double x, double y) { +void SVGCharTspanTextHandler::appendChar (uint32_t c, double x, double y) { // changes of fonts and transformations require a new text element if (!_textNode || _font.changed() || _matrix.changed() || _vertical.changed()) { resetContextNode(); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.hpp index 19825036e02..868a90626e9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** SVGCharTspanTextHandler.h ** +** SVGCharTspanTextHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,21 +18,21 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef SVGCHARTSPANTEXTHANDLER_H -#define SVGCHARTSPANTEXTHANDLER_H +#ifndef SVGCHARTSPANTEXTHANDLER_HPP +#define SVGCHARTSPANTEXTHANDLER_HPP -#include "SVGCharHandler.h" +#include "SVGCharHandler.hpp" class SVGCharTspanTextHandler : public SVGCharTextHandler { public: SVGCharTspanTextHandler (bool selectFontByClass); - void notifyXAdjusted () {_xchanged = true;} - void notifyYAdjusted() {_ychanged = true;} - void appendChar (UInt32 c, double x, double y); - void setInitialContextNode (XMLElementNode *node); + void notifyXAdjusted () override {_xchanged = true;} + void notifyYAdjusted() override {_ychanged = true;} + void appendChar (uint32_t c, double x, double y) override; + void setInitialContextNode (XMLElementNode *node) override; protected: - void resetContextNode (); + void resetContextNode () override; private: bool _xchanged, _ychanged; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.cpp index 2b6e2387558..84c66d82ac1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.cpp @@ -2,7 +2,7 @@ ** SVGOutput.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -20,25 +20,21 @@ #include <algorithm> #include <cmath> +#include <fstream> #include <iomanip> #include <iostream> #include <sstream> -#include "gzstream.h" -#include "Calculator.h" -#include "FileSystem.h" -#include "Message.h" -#include "SVGOutput.h" - +#include "Calculator.hpp" +#include "FileSystem.hpp" +#include "Message.hpp" +#include "SVGOutput.hpp" +#include "utility.hpp" +#include "ZLibOutputStream.hpp" using namespace std; -SVGOutput::SVGOutput (const char *base, string pattern, int zipLevel) - : _path(base ? base : ""), - _pattern(pattern), - _stdout(base == 0), - _zipLevel(zipLevel), - _page(-1), - _os(0) +SVGOutput::SVGOutput (const char *base, const string &pattern, int zipLevel) + : _path(base ? base : ""), _pattern(pattern), _stdout(base == 0), _zipLevel(zipLevel), _page(-1) { } @@ -50,25 +46,20 @@ SVGOutput::SVGOutput (const char *base, string pattern, int zipLevel) ostream& SVGOutput::getPageStream (int page, int numPages) const { string fname = filename(page, numPages); if (fname.empty()) { - delete _os; - _os = 0; + _osptr.reset(); return cout; } if (page == _page) - return *_os; + return *_osptr; _page = page; - delete _os; if (_zipLevel > 0) - _os = new ogzstream(fname.c_str(), _zipLevel); + _osptr.reset(new ZLibOutputStream(fname, _zipLevel)); else - _os = new ofstream(fname.c_str()); - if (!_os || !*_os) { - delete _os; - _os = 0; + _osptr.reset(new ofstream(fname.c_str())); + if (!_osptr) throw MessageException("can't open file "+fname+" for writing"); - } - return *_os; + return *_osptr; } @@ -78,20 +69,12 @@ ostream& SVGOutput::getPageStream (int page, int numPages) const { string SVGOutput::filename (int page, int numPages) const { if (_stdout) return ""; - string pattern = _pattern; - expandFormatString(pattern, page, numPages); - // remove leading and trailing whitespace - stringstream trim; - trim << pattern; - pattern.clear(); - trim >> pattern; + string expanded_pattern = util::trim(expandFormatString(_pattern, page, numPages)); // set and expand default pattern if necessary - if (pattern.empty()) { - pattern = numPages > 1 ? "%f-%p" : "%f"; - expandFormatString(pattern, page, numPages); - } + if (expanded_pattern.empty()) + expanded_pattern = expandFormatString(numPages > 1 ? "%f-%p" : "%f", page, numPages); // append suffix if necessary - FilePath outpath(pattern, true); + FilePath outpath(expanded_pattern, true); if (outpath.suffix().empty()) outpath.suffix(_zipLevel > 0 ? "svgz" : "svg"); string abspath = outpath.absolute(); @@ -100,23 +83,28 @@ string SVGOutput::filename (int page, int numPages) const { } -static int ilog10 (int n) { - int result = 0; - while (n >= 10) { - result++; - n /= 10; - } - return result; +#if 0 +string SVGOutput::outpath (int page, int numPages) const { + string path = filename(page, numPages); + if (path.empty()) + return ""; + size_t pos = path.rfind('/'); + if (pos == string::npos) + return "."; + if (pos == 0) + return "/"; + return path.substr(0, pos); } +#endif -/** Replace expressions in a given string by the corresponing values. +/** Replaces expressions in a given string by the corresponding values and returns the result. * Supported constructs: * %f: basename of the current file (filename without suffix) * %[0-9]?p: current page number * %[0-9]?P: number of pages in DVI file * %[0-9]?(expr): arithmetic expression */ -void SVGOutput::expandFormatString (string &str, int page, int numPages) const { +string SVGOutput::expandFormatString (string str, int page, int numPages) const { string result; while (!str.empty()) { size_t pos = str.find('%'); @@ -134,7 +122,7 @@ void SVGOutput::expandFormatString (string &str, int page, int numPages) const { pos++; } else { - oss << setw(ilog10(numPages)+1) << setfill('0'); + oss << setw(util::ilog10(numPages)+1) << setfill('0'); } switch (str[pos]) { case 'f': @@ -170,5 +158,5 @@ void SVGOutput::expandFormatString (string &str, int page, int numPages) const { str = str.substr(pos+1); } } - str = result; + return result; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.hpp index 283acd16442..d5edebf7865 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** SVGOutput.h ** +** SVGOutput.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,31 +18,36 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_SVGOUTPUT_H -#define DVISVGM_SVGOUTPUT_H +#ifndef SVGOUTPUT_HPP +#define SVGOUTPUT_HPP +#include <memory> #include <ostream> #include <string> -#include "FilePath.h" +#include "FilePath.hpp" struct SVGOutputBase { - virtual ~SVGOutputBase () {} + virtual ~SVGOutputBase () =default; virtual std::ostream& getPageStream (int page, int numPages) const =0; virtual std::string filename (int page, int numPages) const =0; +// virtual std::string outpath (int page, int numPages) const =0; }; class SVGOutput : public SVGOutputBase { public: - SVGOutput (const char *base=0, std::string pattern="", int zipLevel=0); - ~SVGOutput () {delete _os;} - std::ostream& getPageStream (int page, int numPages) const; - std::string filename (int page, int numPages) const; + SVGOutput () : SVGOutput(0, "", 0) {} + SVGOutput (const char *base) : SVGOutput(base, "", 0) {} + SVGOutput (const char *base, const std::string &pattern) : SVGOutput(base, pattern, 0) {} + SVGOutput (const char *base, const std::string &pattern, int zipLevel); + std::ostream& getPageStream (int page, int numPages) const override; + std::string filename (int page, int numPages) const override; +// std::string outpath (int page, int numPages) const override; protected: - void expandFormatString (std::string &str, int page, int numPages) const; + std::string expandFormatString (std::string str, int page, int numPages) const; private: FilePath _path; @@ -50,7 +55,7 @@ class SVGOutput : public SVGOutputBase bool _stdout; ///< write to STDOUT? int _zipLevel; ///< compression level mutable int _page; ///< number of current page being written - mutable std::ostream *_os; + mutable std::unique_ptr<std::ostream> _osptr; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.cpp index 8d5a26ddb9b..af99de0dacb 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.cpp @@ -2,7 +2,7 @@ ** SVGSingleCharTextHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,12 +18,12 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#include "SVGSingleCharTextHandler.h" -#include "XMLNode.h" +#include "SVGSingleCharTextHandler.hpp" +#include "XMLNode.hpp" using namespace std; -void SVGSingleCharTextHandler::appendChar (UInt32 c, double x, double y) { +void SVGSingleCharTextHandler::appendChar (uint32_t c, double x, double y) { const Font *font = _font.get(); XMLElementNode *textNode = createTextNode(x, y); textNode->append(XMLString(font->unicode(c), false)); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.hpp index 0c4a26a4048..f2525dcbce0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** SVGSingleCharTextHandler.h ** +** SVGSingleCharTextHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,17 +18,17 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef SVGSINGLECHARTEXTHANDLER_H -#define SVGSINGLECHARTEXTHANDLER_H +#ifndef SVGSINGLECHARTEXTHANDLER_HPP +#define SVGSINGLECHARTEXTHANDLER_HPP -#include "SVGCharHandler.h" +#include "SVGCharHandler.hpp" class SVGSingleCharTextHandler : public SVGCharTextHandler { public: SVGSingleCharTextHandler (bool createStyleElements) : SVGCharTextHandler(createStyleElements) {} - void appendChar (UInt32 c, double x, double y); + void appendChar (uint32_t c, double x, double y) override; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp index 2e4ac726ded..5a88650b864 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp @@ -2,7 +2,7 @@ ** SVGTree.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -20,17 +20,20 @@ #include <config.h> #include <algorithm> +#include <array> #include <sstream> -#include "BoundingBox.h" -#include "DependencyGraph.h" -#include "DVIToSVG.h" -#include "Font.h" -#include "FontManager.h" -#include "SVGCharHandlerFactory.h" -#include "SVGTree.h" -#include "XMLDocument.h" -#include "XMLNode.h" -#include "XMLString.h" +#include "BoundingBox.hpp" +#include "DependencyGraph.hpp" +#include "DVIToSVG.hpp" +#include "FileSystem.hpp" +#include "Font.hpp" +#include "FontManager.hpp" +#include "FontWriter.hpp" +#include "SVGCharHandlerFactory.hpp" +#include "SVGTree.hpp" +#include "XMLDocument.hpp" +#include "XMLNode.hpp" +#include "XMLString.hpp" using namespace std; @@ -38,6 +41,7 @@ using namespace std; // static class variables bool SVGTree::CREATE_CSS=true; bool SVGTree::USE_FONTS=true; +FontWriter::FontFormat SVGTree::FONT_FORMAT = FontWriter::FontFormat::SVG; bool SVGTree::CREATE_USE_ELEMENTS=false; bool SVGTree::RELATIVE_PATH_CMDS=false; bool SVGTree::MERGE_CHARS=true; @@ -46,16 +50,11 @@ double SVGTree::ZOOM_FACTOR=1.0; SVGTree::SVGTree () { - _charHandler = SVGCharHandlerFactory::createHandler(); + _charHandler.reset(SVGCharHandlerFactory::createHandler()); reset(); } -SVGTree::~SVGTree () { - delete _charHandler; -} - - /** Clears the SVG tree and initializes the root element. */ void SVGTree::reset () { _doc.clear(); @@ -64,7 +63,8 @@ void SVGTree::reset () { _root->addAttribute("xmlns", "http://www.w3.org/2000/svg"); _root->addAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"); _doc.setRootNode(_root); - _page = _defs = 0; + _page = _defs = nullptr; + _styleCDataNode = nullptr; } @@ -94,6 +94,22 @@ void SVGTree::setFont (int num, const Font &font) { } +bool SVGTree::setFontFormat (string formatstr) { + size_t pos = formatstr.find(','); + string opt; + if (pos != string::npos) { + opt = formatstr.substr(pos+1); + formatstr = formatstr.substr(0, pos); + } + FontWriter::FontFormat format = FontWriter::toFontFormat(formatstr); + if (format == FontWriter::FontFormat::UNKNOWN) + return false; + FONT_FORMAT = format; + FontWriter::AUTOHINT_FONTS = (opt == "autohint" || opt == "ah"); + return true; +} + + /** Starts a new page. * @param[in] pageno number of new page */ void SVGTree::newPage (int pageno) { @@ -193,33 +209,30 @@ static string font_info (const Font &font) { void SVGTree::appendFontStyles (const set<const Font*> &fonts) { - if (CREATE_CSS && USE_FONTS && !fonts.empty() && _defs) { - XMLElementNode *styleNode = new XMLElementNode("style"); - styleNode->addAttribute("type", "text/css"); - _root->insertAfter(styleNode, _defs); - typedef map<int, const Font*> SortMap; - SortMap sortmap; - FORALL(fonts, set<const Font*>::const_iterator, it) - if (!dynamic_cast<const VirtualFont*>(*it)) // skip virtual fonts - sortmap[FontManager::instance().fontID(*it)] = *it; + if (CREATE_CSS && USE_FONTS && !fonts.empty() && _page) { + map<int, const Font*> sortmap; + for (const Font *font : fonts) + if (!dynamic_cast<const VirtualFont*>(font)) // skip virtual fonts + sortmap[FontManager::instance().fontID(font)] = font; ostringstream style; // add font style definitions in ascending order - FORALL(sortmap, SortMap::const_iterator, it) { - style << "text.f" << it->first << ' ' - << "{font-family:" << it->second->name() - << ";font-size:" << XMLString(it->second->scaledSize()) << "px"; - if (it->second->color() != Color::BLACK) - style << ";fill:" << it->second->color().svgColorString(); - style << '}'; - if (ADD_COMMENTS) { - string info = font_info(*it->second); - if (!info.empty()) - style << " /* " << info << " */"; + for (auto &idfontpair : sortmap) { + if (CREATE_CSS) { + style << "text.f" << idfontpair.first << ' ' + << "{font-family:" << idfontpair.second->name() + << ";font-size:" << XMLString(idfontpair.second->scaledSize()) << "px"; + if (idfontpair.second->color() != Color::BLACK) + style << ";fill:" << idfontpair.second->color().svgColorString(); + style << '}'; + if (ADD_COMMENTS) { + string info = font_info(*idfontpair.second); + if (!info.empty()) + style << " /* " << info << " */"; + } + style << '\n'; } - style << '\n'; } - XMLCDataNode *cdata = new XMLCDataNode(style.str()); - styleNode->append(cdata); + styleCDataNode()->append(style.str()); } } @@ -227,46 +240,54 @@ void SVGTree::appendFontStyles (const set<const Font*> &fonts) { /** Appends glyph definitions of a given font to the defs section of the SVG tree. * @param[in] font font to be appended * @param[in] chars codes of the characters whose glyph outlines should be appended - * @param[in] cb pointer to callback object for sending feedback to the glyph tracer (may be 0) */ -void SVGTree::append (const PhysicalFont &font, const set<int> &chars, GFGlyphTracer::Callback *cb) { + * @param[in] callback pointer to callback object for sending feedback to the glyph tracer (may be 0) */ +void SVGTree::append (const PhysicalFont &font, const set<int> &chars, GFGlyphTracer::Callback *callback) { if (chars.empty()) return; if (USE_FONTS) { - if (ADD_COMMENTS) { - string info = font_info(font); - if (!info.empty()) - appendToDefs(new XMLCommentNode(string(" font: ")+info+" ")); + if (FONT_FORMAT != FontWriter::FontFormat::SVG) { + ostringstream style; + FontWriter fontWriter(font); + if (fontWriter.writeCSSFontFace(FONT_FORMAT, chars, style, callback)) + styleCDataNode()->append(style.str()); } - XMLElementNode *fontNode = new XMLElementNode("font"); - string fontname = font.name(); - fontNode->addAttribute("id", fontname); - fontNode->addAttribute("horiz-adv-x", XMLString(font.hAdvance())); - appendToDefs(fontNode); - - XMLElementNode *faceNode = new XMLElementNode("font-face"); - faceNode->addAttribute("font-family", fontname); - faceNode->addAttribute("units-per-em", XMLString(font.unitsPerEm())); - if (font.type() != PhysicalFont::MF && !font.verticalLayout()) { - faceNode->addAttribute("ascent", XMLString(font.ascent())); - faceNode->addAttribute("descent", XMLString(font.descent())); + else { + if (ADD_COMMENTS) { + string info = font_info(font); + if (!info.empty()) + appendToDefs(new XMLCommentNode(string(" font: ")+info+" ")); + } + XMLElementNode *fontNode = new XMLElementNode("font"); + string fontname = font.name(); + fontNode->addAttribute("id", fontname); + fontNode->addAttribute("horiz-adv-x", XMLString(font.hAdvance())); + appendToDefs(fontNode); + + XMLElementNode *faceNode = new XMLElementNode("font-face"); + faceNode->addAttribute("font-family", fontname); + faceNode->addAttribute("units-per-em", XMLString(font.unitsPerEm())); + if (!font.verticalLayout()) { + faceNode->addAttribute("ascent", XMLString(font.ascent())); + faceNode->addAttribute("descent", XMLString(font.descent())); + } + fontNode->append(faceNode); + for (int c : chars) + fontNode->append(createGlyphNode(c, font, callback)); } - fontNode->append(faceNode); - FORALL(chars, set<int>::const_iterator, i) - fontNode->append(createGlyphNode(*i, font, cb)); } else if (CREATE_USE_ELEMENTS && &font != font.uniqueFont()) { // If the same character is used in various sizes, we don't want to embed the complete (lengthy) path // descriptions multiple times. Because they would only differ by a scale factor, it's better to // reference the already embedded path together with a transformation attribute and let the SVG renderer // scale the glyphs properly. This is only necessary if we don't want to use font but path elements. - FORALL(chars, set<int>::const_iterator, it) { + for (int c : chars) { ostringstream oss; XMLElementNode *use = new XMLElementNode("use"); - oss << 'g' << FontManager::instance().fontID(&font) << '-' << *it; + oss << 'g' << FontManager::instance().fontID(&font) << '-' << c; use->addAttribute("id", oss.str()); oss.str(""); - oss << "#g" << FontManager::instance().fontID(font.uniqueFont()) << '-' << *it; + oss << "#g" << FontManager::instance().fontID(font.uniqueFont()) << '-' << c; use->addAttribute("xlink:href", oss.str()); double scale = font.scaledSize()/font.uniqueFont()->scaledSize(); if (scale != 1.0) { @@ -278,8 +299,8 @@ void SVGTree::append (const PhysicalFont &font, const set<int> &chars, GFGlyphTr } } else { - FORALL(chars, set<int>::const_iterator, i) - appendToDefs(createGlyphNode(*i, font, cb)); + for (int c : chars) + appendToDefs(createGlyphNode(c, font, callback)); } } @@ -318,9 +339,9 @@ void SVGTree::removeRedundantElements () { // collect dependencies between clipPath elements in the defs section of the SVG tree DependencyGraph<string> idTree; - for (vector<XMLElementNode*>::iterator it=clipElements.begin(); it != clipElements.end(); ++it) { - if (const char *id = (*it)->getAttributeValue("id")) { - if (const char *url = (*it)->getAttributeValue("clip-path")) + for (const XMLElementNode *clip : clipElements) { + if (const char *id = clip->getAttributeValue("id")) { + if (const char *url = clip->getAttributeValue("clip-path")) idTree.insert(extract_id_from_url(url), id); else idTree.insert(id); @@ -330,15 +351,27 @@ void SVGTree::removeRedundantElements () { vector<XMLElementNode*> descendants; _page->getDescendants(0, "clip-path", descendants); // remove referenced IDs and their dependencies from the dependency graph - for (vector<XMLElementNode*>::iterator it=descendants.begin(); it != descendants.end(); ++it) { - string idref = extract_id_from_url((*it)->getAttributeValue("clip-path")); + for (const XMLElementNode *elem : descendants) { + string idref = extract_id_from_url(elem->getAttributeValue("clip-path")); idTree.removeDependencyPath(idref); } descendants.clear(); vector<string> ids; idTree.getKeys(ids); - for (vector<string>::iterator it=ids.begin(); it != ids.end(); ++it) { - XMLElementNode *node = _defs->getFirstDescendant("clipPath", "id", it->c_str()); + for (const string &str : ids) { + XMLElementNode *node = _defs->getFirstDescendant("clipPath", "id", str.c_str()); _defs->remove(node); } } + + +XMLCDataNode* SVGTree::styleCDataNode () { + if (!_styleCDataNode) { + XMLElementNode *styleNode = new XMLElementNode("style"); + styleNode->addAttribute("type", "text/css"); + _root->insertBefore(styleNode, _page); + _styleCDataNode = new XMLCDataNode; + styleNode->append(_styleCDataNode); + } + return _styleCDataNode; +}
\ No newline at end of file diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.hpp index 278d386e254..82ccc8332dc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** SVGTree.h ** +** SVGTree.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,31 +18,32 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_SVGTREE_H -#define DVISVGM_SVGTREE_H +#ifndef SVGTREE_HPP +#define SVGTREE_HPP #include <map> +#include <memory> #include <set> #include <stack> -#include "Color.h" -#include "GFGlyphTracer.h" -#include "Matrix.h" -#include "SVGCharHandler.h" -#include "XMLDocument.h" -#include "XMLNode.h" +#include "Color.hpp" +#include "FontWriter.hpp" +#include "GFGlyphTracer.hpp" +#include "Matrix.hpp" +#include "SVGCharHandler.hpp" +#include "XMLDocument.hpp" +#include "XMLNode.hpp" -class BoundingBox; -class Color; +class BoundingBox; +class Color; class Font; -class Matrix; -class PhysicalFont; +class Matrix; +class PhysicalFont; class SVGTree { public: SVGTree (); - ~SVGTree (); void reset (); - void write (std::ostream &os) const {_doc.write(os);} + bool write (std::ostream &os) const {return bool(_doc.write(os));} void newPage (int pageno); void appendToDefs (XMLNode *node); void appendToPage (XMLNode *node); @@ -51,12 +52,13 @@ class SVGTree { void appendToRoot (XMLNode *node) {_root->append(node);} void appendChar (int c, double x, double y) {_charHandler->appendChar(c, x, y);} void appendFontStyles (const std::set<const Font*> &fonts); - void append (const PhysicalFont &font, const std::set<int> &chars, GFGlyphTracer::Callback *cb=0); + void append (const PhysicalFont &font, const std::set<int> &chars, GFGlyphTracer::Callback *callback=0); void pushContextElement (XMLElementNode *node); void popContextElement (); void removeRedundantElements (); void setBBox (const BoundingBox &bbox); void setFont (int id, const Font &font); + static bool setFontFormat (std::string formatstr); void setX (double x) {_charHandler->notifyXAdjusted();} void setY (double y) {_charHandler->notifyYAdjusted();} void setMatrix (const Matrix &m) {_charHandler->setMatrix(m);} @@ -67,10 +69,14 @@ class SVGTree { const Matrix& getMatrix () const {return _charHandler->getMatrix();} XMLElementNode* rootNode () const {return _root;} + protected: + XMLCDataNode* styleCDataNode (); + public: static bool USE_FONTS; ///< if true, create font references and don't draw paths directly static bool CREATE_CSS; ///< define and use CSS classes to reference fonts? static bool CREATE_USE_ELEMENTS; ///< allow generation of <use/> elements? + static FontWriter::FontFormat FONT_FORMAT; ///< format of fonts to be embedded static bool RELATIVE_PATH_CMDS; ///< relative path commands rather than absolute ones? static bool MERGE_CHARS; ///< whether to merge chars with common properties into the same <text> tag static bool ADD_COMMENTS; ///< add comments with additional information @@ -79,7 +85,8 @@ class SVGTree { private: XMLDocument _doc; XMLElementNode *_root, *_page, *_defs; - SVGCharHandler *_charHandler; + XMLCDataNode *_styleCDataNode; + std::unique_ptr<SVGCharHandler> _charHandler; std::stack<XMLElementNode*> _contextElementStack; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.cpp index 999bddecd38..97a567fd20d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.cpp @@ -2,7 +2,7 @@ ** ShadingPatch.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,28 +19,28 @@ *************************************************************************/ #include <sstream> -#include "ShadingPatch.h" -#include "TensorProductPatch.h" -#include "TriangularPatch.h" +#include "ShadingPatch.hpp" +#include "TensorProductPatch.hpp" +#include "TriangularPatch.hpp" using namespace std; /** Get functions to get/set the current color depending on the assigned color space. */ void ShadingPatch::colorQueryFuncs (ColorGetter &getter, ColorSetter &setter) const { switch (_colorspace) { - case Color::CMYK_SPACE: + case Color::ColorSpace::CMYK: getter = &Color::getCMYK; setter = &Color::setCMYK; break; - case Color::LAB_SPACE: + case Color::ColorSpace::LAB: getter = &Color::getLab; setter = &Color::setLab; break; - case Color::RGB_SPACE: + case Color::ColorSpace::RGB: getter = &Color::getRGB; setter = &Color::setRGB; break; - case Color::GRAY_SPACE: + case Color::ColorSpace::GRAY: getter = &Color::getGray; setter = &Color::setGray; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.hpp index 89c9ece24e7..25d88d0ac49 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** ShadingPatch.h ** +** ShadingPatch.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,19 +18,19 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_SHADINGPATCH_H -#define DVISVGM_SHADINGPATCH_H +#ifndef SHADINGPATCH_HPP +#define SHADINGPATCH_HPP -#include "Color.h" -#include "GraphicsPath.h" -#include "MessageException.h" +#include "Color.hpp" +#include "GraphicsPath.hpp" +#include "MessageException.hpp" class ShadingPatch { public: struct Callback { - virtual ~Callback () {} + virtual ~Callback () =default; virtual void patchSegment (GraphicsPath<double> &path, const Color &color) =0; }; @@ -39,7 +39,7 @@ class ShadingPatch public: ShadingPatch (Color::ColorSpace colorSpace) : _colorspace(colorSpace) {} - virtual ~ShadingPatch () {} + virtual ~ShadingPatch () =default; virtual int psShadingType () const =0; virtual void approximate (int gridsize, bool overlap, double delta, Callback &callback) const =0; virtual void getBBox (BoundingBox &bbox) const =0; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.cpp index 5924022400f..696c99ac18d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.cpp @@ -2,7 +2,7 @@ ** SignalHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -22,7 +22,7 @@ #include <cerrno> #include <csignal> #include <cstdlib> -#include "SignalHandler.h" +#include "SignalHandler.hpp" using namespace std; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.hpp index 08171fb6785..c1c48346d43 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** SignalHandler.h ** +** SignalHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,8 +18,8 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_SIGNALHANDLER_H -#define DVISVGM_SIGNALHANDLER_H +#ifndef SIGNALHANDLER_HPP +#define SIGNALHANDLER_HPP #include <exception> diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialActions.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialActions.hpp index 23548a2370f..5dfaaa17b08 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialActions.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialActions.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** SpecialActions.h ** +** SpecialActions.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,13 +18,13 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_SPECIALACTIONS_H -#define DVISVGM_SPECIALACTIONS_H +#ifndef SPECIALACTIONS_HPP +#define SPECIALACTIONS_HPP #include <string> -#include "BoundingBox.h" -#include "Color.h" -#include "Matrix.h" +#include "BoundingBox.hpp" +#include "Color.hpp" +#include "Matrix.hpp" class XMLNode; class XMLElementNode; @@ -32,7 +32,7 @@ class XMLElementNode; class SpecialActions { public: - virtual ~SpecialActions () {} + virtual ~SpecialActions () =default; virtual double getX () const =0; virtual double getY () const =0; virtual void setX (double x) =0; @@ -66,29 +66,29 @@ class SpecialActions class EmptySpecialActions : public SpecialActions { public: - double getX () const {return 0;} - double getY () const {return 0;} - void setX (double x) {} - void setY (double y) {} - void finishLine () {} - void setColor (const Color &color) {} - void setBgColor (const Color &color) {} - Color getColor () const {return Color::BLACK;} - void setMatrix (const Matrix &m) {} - const Matrix& getMatrix () const {return _matrix;} - void getPageTransform (Matrix &matrix) const {} - void appendToPage (XMLNode *node) {} - void appendToDefs (XMLNode *node) {} - void prependToPage (XMLNode *node) {} - void pushContextElement (XMLElementNode *node) {} - void popContextElement () {} - BoundingBox& bbox () {return _bbox;} - BoundingBox& bbox (const std::string &name, bool reset=false) {return _bbox;} - void embed (const BoundingBox &bbox) {} - void embed (const DPair &p, double r=0) {} - unsigned getCurrentPageNumber() const {return 0;} - std::string getSVGFilename (unsigned pageno) const {return "";} - std::string getBBoxFormatString () const {return "";} + double getX () const override {return 0;} + double getY () const override {return 0;} + void setX (double x) override {} + void setY (double y) override {} + void finishLine () override {} + void setColor (const Color &color) override {} + void setBgColor (const Color &color) override {} + Color getColor () const override {return Color::BLACK;} + void setMatrix (const Matrix &m) override {} + const Matrix& getMatrix () const override {return _matrix;} + void getPageTransform (Matrix &matrix) const override {} + void appendToPage (XMLNode *node) override {} + void appendToDefs (XMLNode *node) override {} + void prependToPage (XMLNode *node) override {} + void pushContextElement (XMLElementNode *node) override {} + void popContextElement () override {} + BoundingBox& bbox () override {return _bbox;} + BoundingBox& bbox (const std::string &name, bool reset=false) override {return _bbox;} + void embed (const BoundingBox &bbox) override {} + void embed (const DPair &p, double r=0) override {} + unsigned getCurrentPageNumber() const override {return 0;} + std::string getSVGFilename (unsigned pageno) const override {return "";} + std::string getBBoxFormatString () const override {return "";} private: BoundingBox _bbox; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.hpp index a55a865a117..1822181ad4c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** SpecialHandler.h ** +** SpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,12 +18,12 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_SPECIALHANDLER_H -#define DVISVGM_SPECIALHANDLER_H +#ifndef SPECIALHANDLER_HPP +#define SPECIALHANDLER_HPP #include <istream> #include <list> -#include "MessageException.h" +#include "MessageException.hpp" class SpecialActions; @@ -38,28 +38,28 @@ struct SpecialException : public MessageException struct DVIPreprocessingListener { - virtual ~DVIPreprocessingListener () {} + virtual ~DVIPreprocessingListener () =default; virtual void dviPreprocessingFinished () =0; }; struct DVIBeginPageListener { - virtual ~DVIBeginPageListener () {} + virtual ~DVIBeginPageListener () =default; virtual void dviBeginPage (unsigned pageno, SpecialActions &actions) =0; }; struct DVIEndPageListener { - virtual ~DVIEndPageListener () {} + virtual ~DVIEndPageListener () =default; virtual void dviEndPage (unsigned pageno, SpecialActions &actions) =0; }; struct DVIPositionListener { - virtual ~DVIPositionListener () {} + virtual ~DVIPositionListener () =default; virtual void dviMovedTo (double x, double y, SpecialActions &actions) =0; }; @@ -68,7 +68,7 @@ class SpecialHandler { friend class SpecialManager; public: - virtual ~SpecialHandler () {} + virtual ~SpecialHandler () =default; virtual const char** prefixes () const=0; virtual const char* info () const=0; virtual const char* name () const=0; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp index db4bd42b3d0..9a2027cb8f7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp @@ -2,7 +2,7 @@ ** SpecialManager.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -21,10 +21,10 @@ #include <config.h> #include <iomanip> #include <sstream> -#include "SpecialActions.h" -#include "SpecialHandler.h" -#include "SpecialManager.h" -#include "PsSpecialHandler.h" +#include "SpecialActions.hpp" +#include "SpecialHandler.hpp" +#include "SpecialManager.hpp" +#include "PsSpecialHandler.hpp" using namespace std; @@ -44,8 +44,8 @@ SpecialManager& SpecialManager::instance() { /** Remove all registered handlers. */ void SpecialManager::unregisterHandlers () { - FORALL(_pool, vector<SpecialHandler*>::iterator, it) - delete *it; + for (SpecialHandler *handler : _pool) + delete handler; _pool.clear(); _handlers.clear(); _endPageListeners.clear(); @@ -82,14 +82,14 @@ void SpecialManager::registerHandler (SpecialHandler *handler) { * @param[in] ignorelist list of special names to be ignored */ void SpecialManager::registerHandlers (SpecialHandler **handlers, const char *ignorelist) { if (handlers) { - string ign = ignorelist ? ignorelist : ""; - FORALL(ign, string::iterator, it) - if (!isalnum(*it)) - *it = '%'; - ign = "%"+ign+"%"; + string ignorestr = ignorelist ? ignorelist : ""; + for (char &c : ignorestr) + if (!isalnum(c)) + c = '%'; + ignorestr = "%"+ignorestr+"%"; for (; *handlers; handlers++) { - if (!(*handlers)->name() || ign.find("%"+string((*handlers)->name())+"%") == string::npos) + if (!(*handlers)->name() || ignorestr.find("%"+string((*handlers)->name())+"%") == string::npos) registerHandler(*handlers); else delete *handlers; @@ -102,7 +102,7 @@ void SpecialManager::registerHandlers (SpecialHandler **handlers, const char *ig * @param[in] prefix the special prefix, e.g. "color" or "em" * @return in case of success: pointer to handler, 0 otherwise */ SpecialHandler* SpecialManager::findHandler (const string &prefix) const { - ConstIterator it = _handlers.find(prefix); + auto it = _handlers.find(prefix); if (it != _handlers.end()) return it->second; return 0; @@ -149,40 +149,39 @@ bool SpecialManager::process (const string &special, double dvi2bp, SpecialActio void SpecialManager::notifyPreprocessingFinished () const { - FORALL(_preprocListeners, vector<DVIPreprocessingListener*>::const_iterator, it) - (*it)->dviPreprocessingFinished(); + for (DVIPreprocessingListener *listener : _preprocListeners) + listener->dviPreprocessingFinished(); } void SpecialManager::notifyBeginPage (unsigned pageno, SpecialActions &actions) const { - FORALL(_beginPageListeners, vector<DVIBeginPageListener*>::const_iterator, it) - (*it)->dviBeginPage(pageno, actions); + for (DVIBeginPageListener *listener : _beginPageListeners) + listener->dviBeginPage(pageno, actions); } void SpecialManager::notifyEndPage (unsigned pageno, SpecialActions &actions) const { - FORALL(_endPageListeners, vector<DVIEndPageListener*>::const_iterator, it) - (*it)->dviEndPage(pageno, actions); + for (DVIEndPageListener *listener : _endPageListeners) + listener->dviEndPage(pageno, actions); } void SpecialManager::notifyPositionChange (double x, double y, SpecialActions &actions) const { - FORALL(_positionListeners, vector<DVIPositionListener*>::const_iterator, it) - (*it)->dviMovedTo(x, y, actions); + for (DVIPositionListener *listener : _positionListeners) + listener->dviMovedTo(x, y, actions); } void SpecialManager::writeHandlerInfo (ostream &os) const { ios::fmtflags osflags(os.flags()); - typedef map<string, SpecialHandler*> SortMap; - SortMap m; - FORALL(_handlers, ConstIterator, it) - if (it->second->name()) - m[it->second->name()] = it->second; - FORALL(m, SortMap::iterator, it) { - os << setw(10) << left << it->second->name() << ' '; - if (it->second->info()) - os << it->second->info(); + HandlerMap sortmap; + for (const auto &strhandlerpair : _handlers) + if (strhandlerpair.second->name()) + sortmap[strhandlerpair.second->name()] = strhandlerpair.second; + for (auto &strhandlerpair : sortmap) { + os << setw(10) << left << strhandlerpair.second->name() << ' '; + if (strhandlerpair.second->info()) + os << strhandlerpair.second->info(); os << endl; } os.flags(osflags); // restore format flags diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.hpp index a06ea5899e3..919881811a4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** SpecialManager.h ** +** SpecialManager.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,14 +18,14 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_SPECIALMANAGER_H -#define DVISVGM_SPECIALMANAGER_H +#ifndef SPECIALMANAGER_HPP +#define SPECIALMANAGER_HPP #include <map> #include <ostream> #include <string> #include <vector> -#include "SpecialHandler.h" +#include "SpecialHandler.hpp" class SpecialActions; @@ -34,8 +34,6 @@ class SpecialManager private: typedef std::vector<SpecialHandler*> HandlerPool; typedef std::map<std::string,SpecialHandler*> HandlerMap; - typedef HandlerMap::iterator Iterator; - typedef HandlerMap::const_iterator ConstIterator; public: ~SpecialManager (); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.cpp index f15023f58da..d31a92bcb84 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.cpp @@ -2,7 +2,7 @@ ** StreamReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,9 +19,8 @@ *************************************************************************/ #include <config.h> -#include "CRC32.h" -#include "StreamReader.h" -#include "macros.h" +#include "CRC32.hpp" +#include "StreamReader.hpp" using namespace std; @@ -36,10 +35,10 @@ istream& StreamReader::replaceStream (istream &in) { /** Reads an unsigned integer from assigned input stream. * @param[in] bytes number of bytes to read (max. 4) * @return read integer */ -UInt32 StreamReader::readUnsigned (int bytes) { - UInt32 ret = 0; +uint32_t StreamReader::readUnsigned (int bytes) { + uint32_t ret = 0; for (bytes--; bytes >= 0 && !_is->eof(); bytes--) { - UInt32 b = UInt32(_is->get()); + uint32_t b = uint32_t(_is->get()); ret |= b << (8*bytes); } return ret; @@ -50,8 +49,8 @@ UInt32 StreamReader::readUnsigned (int bytes) { * @param[in] bytes number of bytes to read (max. 4) * @param[in,out] crc32 checksum to be updated * @return read integer */ -UInt32 StreamReader::readUnsigned (int bytes, CRC32 &crc32) { - UInt32 ret = readUnsigned(bytes); +uint32_t StreamReader::readUnsigned (int bytes, CRC32 &crc32) { + uint32_t ret = readUnsigned(bytes); crc32.update(ret, bytes); return ret; } @@ -60,8 +59,8 @@ UInt32 StreamReader::readUnsigned (int bytes, CRC32 &crc32) { /** Reads an signed integer from assigned input stream. * @param[in] bytes number of bytes to read (max. 4) * @return read integer */ -Int32 StreamReader::readSigned (int bytes) { - Int32 ret = Int32(_is->get()); +int32_t StreamReader::readSigned (int bytes) { + int32_t ret = int32_t(_is->get()); if (ret & 128) // negative value? ret |= 0xffffff00; for (bytes-=2; bytes >= 0 && !_is->eof(); bytes--) @@ -74,9 +73,9 @@ Int32 StreamReader::readSigned (int bytes) { * @param[in] bytes number of bytes to read (max. 4) * @param[in,out] crc32 checksum to be updated * @return read integer */ -Int32 StreamReader::readSigned (int bytes, CRC32 &crc32) { - Int32 ret = readSigned(bytes); - crc32.update(UInt32(ret), bytes); +int32_t StreamReader::readSigned (int bytes, CRC32 &crc32) { + int32_t ret = readSigned(bytes); + crc32.update(uint32_t(ret), bytes); return ret; } @@ -99,7 +98,7 @@ string StreamReader::readString () { * @return the string read */ string StreamReader::readString (CRC32 &crc32, bool finalZero) { string ret = readString(); - crc32.update((const UInt8*)ret.c_str(), ret.length()); + crc32.update((const uint8_t*)ret.c_str(), ret.length()); if (finalZero) crc32.update(0, 1); return ret; @@ -136,14 +135,14 @@ string StreamReader::readString (int length, CRC32 &crc32) { } -vector<UInt8>& StreamReader::readBytes (int n, vector<UInt8> &bytes) { +vector<uint8_t>& StreamReader::readBytes (int n, vector<uint8_t> &bytes) { if (n > 0) _is->read((char*)&bytes[0], n); return bytes; } -vector<UInt8>& StreamReader::readBytes (int n, vector<UInt8> &bytes, CRC32 &crc32) { +vector<uint8_t>& StreamReader::readBytes (int n, vector<uint8_t> &bytes, CRC32 &crc32) { readBytes(n, bytes); crc32.update(&bytes[0], bytes.size()); return bytes; @@ -153,7 +152,7 @@ vector<UInt8>& StreamReader::readBytes (int n, vector<UInt8> &bytes, CRC32 &crc3 int StreamReader::readByte (CRC32 &crc32) { int ret = readByte(); if (ret >= 0) { - const UInt8 c = UInt8(ret & 0xff); + const uint8_t c = uint8_t(ret & 0xff); crc32.update(&c, 1); } return ret; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.hpp index b8111afc9ca..45cafe73423 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** StreamReader.h ** +** StreamReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,14 +18,13 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_STREAMREADER_H -#define DVISVGM_STREAMREADER_H +#ifndef STREAMREADER_HPP +#define STREAMREADER_HPP #include <istream> #include <string> #include <vector> -#include "MessageException.h" -#include "types.h" +#include "MessageException.hpp" class CRC32; @@ -33,21 +32,21 @@ class StreamReader { public: StreamReader (std::istream &is) : _is(&is) {} - virtual ~StreamReader () {} + virtual ~StreamReader () =default; bool isStreamValid () const {return _is;} bool eof () const {return _is->eof();} void clearStream () {_is->clear();} std::istream& replaceStream (std::istream &s); - UInt32 readUnsigned (int n); - UInt32 readUnsigned (int n, CRC32 &crc32); - Int32 readSigned (int n); - Int32 readSigned (int n, CRC32 &crc32); + uint32_t readUnsigned (int n); + uint32_t readUnsigned (int n, CRC32 &crc32); + int32_t readSigned (int n); + int32_t readSigned (int n, CRC32 &crc32); std::string readString (); std::string readString (CRC32 &crc32, bool finalZero=false); std::string readString (int length); std::string readString (int length, CRC32 &crc32); - std::vector<UInt8>& readBytes (int n, std::vector<UInt8> &bytes); - std::vector<UInt8>& readBytes (int n, std::vector<UInt8> &bytes, CRC32 &crc32); + std::vector<uint8_t>& readBytes (int n, std::vector<uint8_t> &bytes); + std::vector<uint8_t>& readBytes (int n, std::vector<uint8_t> &bytes, CRC32 &crc32); int readByte () {return _is->get();} int readByte (CRC32 &crc32); void seek (std::streampos pos, std::ios::seekdir dir) {_is->seekg(pos, dir);} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.cpp index 5b50b33673a..16bd13c82ce 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.cpp @@ -2,7 +2,7 @@ ** StreamWriter.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,8 +19,8 @@ *************************************************************************/ #include <config.h> -#include "CRC32.h" -#include "StreamWriter.h" +#include "CRC32.hpp" +#include "StreamWriter.hpp" using namespace std; @@ -28,7 +28,7 @@ using namespace std; /** Writes an unsigned integer to the output stream. * @param[in] val the value to write * @param[in] n number of bytes to be considered */ -void StreamWriter::writeUnsigned (UInt32 val, int n) { +void StreamWriter::writeUnsigned (uint32_t val, int n) { for (n--; n >= 0; n--) _os.put(char((val >> (8*n)) & 0xff)); } @@ -37,8 +37,8 @@ void StreamWriter::writeUnsigned (UInt32 val, int n) { /** Writes a signed integer to the output stream. * @param[in] val the value to write * @param[in] n number of bytes to be considered */ -void StreamWriter::writeSigned (Int32 val, int n) { - writeUnsigned((UInt32)val, n); +void StreamWriter::writeSigned (int32_t val, int n) { + writeUnsigned((uint32_t)val, n); } @@ -57,7 +57,7 @@ void StreamWriter::writeString (const string &str, bool finalZero) { * @param[in] val the value to write * @param[in] n number of bytes to be considered * @param[in,out] crc32 checksum to be updated */ -void StreamWriter::writeUnsigned (UInt32 val, int n, CRC32 &crc32) { +void StreamWriter::writeUnsigned (uint32_t val, int n, CRC32 &crc32) { writeUnsigned(val, n); crc32.update(val, n); } @@ -67,8 +67,8 @@ void StreamWriter::writeUnsigned (UInt32 val, int n, CRC32 &crc32) { * @param[in] val the value to write * @param[in] n number of bytes to be considered * @param[in,out] crc32 checksum to be updated */ -void StreamWriter::writeSigned (Int32 val, int n, CRC32 &crc32) { - writeUnsigned((UInt32)val, n, crc32); +void StreamWriter::writeSigned (int32_t val, int n, CRC32 &crc32) { + writeUnsigned((uint32_t)val, n, crc32); } @@ -78,5 +78,5 @@ void StreamWriter::writeSigned (Int32 val, int n, CRC32 &crc32) { * @param[in] finalZero if true, a final 0-byte is appended */ void StreamWriter::writeString (const std::string &str, CRC32 &crc32, bool finalZero) { writeString(str, finalZero); - crc32.update((const UInt8*)str.c_str(), str.length() + (finalZero ? 1 : 0)); + crc32.update((const uint8_t*)str.c_str(), str.length() + (finalZero ? 1 : 0)); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.hpp index ed10770643a..bc6e504348a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** StreamWriter.h ** +** StreamWriter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,11 +18,10 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_STREAMWRITER_H -#define DVISVGM_STREAMWRITER_H +#ifndef STREAMWRITER_HPP +#define STREAMWRITER_HPP #include <ostream> -#include "types.h" class CRC32; @@ -31,12 +30,12 @@ class StreamWriter { public: StreamWriter (std::ostream &os) : _os(os) {} - virtual ~StreamWriter () {} - void writeUnsigned (UInt32 val, int n); - void writeSigned (Int32 val, int n); + virtual ~StreamWriter () =default; + void writeUnsigned (uint32_t val, int n); + void writeSigned (int32_t val, int n); void writeString (const std::string &str, bool finalZero=false); - void writeUnsigned (UInt32 val, int n, CRC32 &crc32); - void writeSigned (Int32 val, int n, CRC32 &crc32); + void writeUnsigned (uint32_t val, int n, CRC32 &crc32); + void writeSigned (int32_t val, int n, CRC32 &crc32); void writeString (const std::string &str, CRC32 &crc32, bool finalZero=false); private: diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.cpp index 8b125ac5ef9..9d8c76eff77 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.cpp @@ -2,7 +2,7 @@ ** Subfont.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -23,9 +23,9 @@ #include <cstring> #include <fstream> #include <limits> -#include "FileFinder.h" -#include "Message.h" -#include "Subfont.h" +#include "FileFinder.hpp" +#include "Message.hpp" +#include "Subfont.hpp" using namespace std; @@ -33,7 +33,7 @@ using namespace std; // helper functions static int skip_mapping_data (istream &is); -static bool scan_line (const char *line, int lineno, UInt16 *mapping, const string &fname, long &pos); +static bool scan_line (const char *line, int lineno, uint16_t *mapping, const string &fname, long &pos); /** Constructs a new SubfontDefinition object. @@ -52,7 +52,7 @@ SubfontDefinition::SubfontDefinition (const string &name, const char *fpath) : _ while (is && !isspace(is.peek())) id += is.get(); if (!id.empty()) { - pair<Iterator, bool> state = _subfonts.insert(pair<string,Subfont*>(id, (Subfont*)0)); + auto state = _subfonts.emplace(pair<string,Subfont*>(id, (Subfont*)0)); if (state.second) // id was not present in map already state.first->second = new Subfont(*this, state.first->first); skip_mapping_data(is); @@ -63,8 +63,8 @@ SubfontDefinition::SubfontDefinition (const string &name, const char *fpath) : _ SubfontDefinition::~SubfontDefinition () { - for (Iterator it=_subfonts.begin(); it != _subfonts.end(); ++it) - delete it->second; + for (auto &entry : _subfonts) + delete entry.second; } @@ -79,7 +79,7 @@ SubfontDefinition* SubfontDefinition::lookup (const std::string &name) { if (it != sfdMap.end()) return it->second; SubfontDefinition *sfd=0; - if (const char *path = FileFinder::lookup(name+".sfd", false)) { + if (const char *path = FileFinder::instance().lookup(name+".sfd", false)) { sfd = new SubfontDefinition(name, path); sfdMap[name] = sfd; } @@ -89,13 +89,13 @@ SubfontDefinition* SubfontDefinition::lookup (const std::string &name) { /** Returns the full path to the corresponding .sfd file or 0 if it can't be found. */ const char* SubfontDefinition::path () const { - return FileFinder::lookup(filename(), false); + return FileFinder::instance().lookup(filename(), false); } /** Returns the subfont with the given ID, or 0 if it doesn't exist. */ Subfont* SubfontDefinition::subfont (const string &id) const { - ConstIterator it = _subfonts.find(id); + auto it = _subfonts.find(id); if (it != _subfonts.end()) return it->second; return 0; @@ -104,8 +104,8 @@ Subfont* SubfontDefinition::subfont (const string &id) const { /** Returns all subfonts defined in this SFD. */ int SubfontDefinition::subfonts (vector<Subfont*> &sfs) const { - for (ConstIterator it=_subfonts.begin(); it != _subfonts.end(); ++it) - sfs.push_back(it->second); + for (const auto &strsfpair : _subfonts) + sfs.push_back(strsfpair.second); return int(sfs.size()); } @@ -152,8 +152,8 @@ bool Subfont::read () { lineno += skip_mapping_data(is); else { // build mapping array - _mapping = new UInt16[256]; - memset(_mapping, 0, 256*sizeof(UInt16)); + _mapping = new uint16_t[256]; + memset(_mapping, 0, 256*sizeof(uint16_t)); long pos=0; char buf[1024]; bool complete=false; @@ -174,7 +174,7 @@ bool Subfont::read () { * (local) character code of the subfont. * @param[in] c local character code relative to the subfont * @return character code of the target font */ -UInt16 Subfont::decode (unsigned char c) { +uint16_t Subfont::decode (unsigned char c) { if (!_mapping && !read()) return 0; return _mapping[c]; @@ -211,7 +211,7 @@ static int skip_mapping_data (istream &is) { * @param[in] fname name of the mapfile being scanned * @param[in,out] offset position/index of next mapping value * @return true if the line is the last one the current mapping sequence, i.e. the line doesn't end with a backslash */ -static bool scan_line (const char *line, int lineno, UInt16 *mapping, const string &fname, long &offset) { +static bool scan_line (const char *line, int lineno, uint16_t *mapping, const string &fname, long &offset) { const char *p=line; char *q; for (; *p && isspace(*p); p++); @@ -256,7 +256,7 @@ static bool scan_line (const char *line, int lineno, UInt16 *mapping, const stri for (long v=val1; v <= val2; v++) { if (mapping[offset]) throw SubfontException(oss << "mapping of character " << offset << " already defined", fname, lineno); - mapping[offset++] = static_cast<UInt16>(v); + mapping[offset++] = static_cast<uint16_t>(v); } } for (p=q; *p && isspace(*p); p++); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.hpp index e0887589d67..46c322a4c08 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** Subfont.h ** +** Subfont.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,16 +18,15 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_SUBFONT_H -#define DVISVGM_SUBFONT_H +#ifndef SUBFONT_HPP +#define SUBFONT_HPP #include <istream> #include <map> #include <sstream> #include <string> #include <vector> -#include "MessageException.h" -#include "types.h" +#include "MessageException.hpp" class Subfont; @@ -38,8 +37,6 @@ class Subfont; class SubfontDefinition { typedef std::map<std::string, Subfont*> Subfonts; - typedef Subfonts::iterator Iterator; - typedef Subfonts::const_iterator ConstIterator; public: ~SubfontDefinition (); static SubfontDefinition* lookup (const std::string &name); @@ -67,7 +64,7 @@ class Subfont public: ~Subfont(); const std::string& id () const {return _id;} - UInt16 decode (unsigned char c); + uint16_t decode (unsigned char c); protected: Subfont (SubfontDefinition &sfd, const std::string &id) : _sfd(sfd), _id(id), _mapping(0) {} @@ -76,7 +73,7 @@ class Subfont private: SubfontDefinition &_sfd; ///< SubfontDefinition where this Subfont belongs to const std::string &_id; ///< id of this subfont as specified in the .sfd file - UInt16 *_mapping; ///< the character mapping table with 256 entries + uint16_t *_mapping; ///< the character mapping table with 256 entries }; @@ -84,12 +81,12 @@ class SubfontException : public MessageException { public: SubfontException (const std::string &msg, const std::string &fname, int lineno=0) - : MessageException(msg), _fname(fname), _lineno(lineno) {} + : MessageException(msg), _fname(fname), _lineno(lineno) {} SubfontException (const std::ostream &oss, const std::string &fname, int lineno=0) - : MessageException(dynamic_cast<const std::ostringstream&>(oss).str()), _fname(fname), _lineno(lineno) {} + : MessageException(dynamic_cast<const std::ostringstream&>(oss).str()), _fname(fname), _lineno(lineno) {} - virtual ~SubfontException () throw() {} + virtual ~SubfontException () throw() =default; const char* filename () const {return _fname.c_str();} int lineno () const {return _lineno;} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/System.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/System.cpp index dfb7d7ed04d..30af5e0aa00 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/System.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/System.cpp @@ -2,7 +2,7 @@ ** System.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -20,7 +20,7 @@ #include <config.h> #include <ctime> -#include "System.h" +#include "System.hpp" #if defined (HAVE_SYS_TIME_H) #include <sys/time.h> @@ -47,4 +47,3 @@ double System::time () { return double(myclock)/CLOCKS_PER_SEC; #endif } - diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/System.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/System.hpp index 2556e44ed95..19f89f7074f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/System.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/System.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** System.h ** +** System.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,8 +18,8 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_SYSTEM_H -#define DVISVGM_SYSTEM_H +#ifndef SYSTEM_HPP +#define SYSTEM_HPP namespace System { diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.cpp index 66042f70263..94901437c7a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.cpp @@ -2,7 +2,7 @@ ** TFM.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -21,11 +21,11 @@ #include <config.h> #include <fstream> #include <vector> -#include "FileFinder.h" -#include "Length.h" -#include "Message.h" -#include "StreamReader.h" -#include "TFM.h" +#include "FileFinder.hpp" +#include "Length.hpp" +#include "Message.hpp" +#include "StreamReader.hpp" +#include "TFM.hpp" using namespace std; @@ -43,29 +43,23 @@ static void read_words (StreamReader &reader, vector<T> &v, unsigned n) { } -/** Converts a TFM fix point value to double. */ -static inline double fix2double (FixWord fix) { - return double(fix)/(1 << 20); -} - - -TFM::TFM (istream &is) : _checksum(0), _firstChar(0), _lastChar(0), _designSize(0) { +TFM::TFM (istream &is) : _checksum(0), _firstChar(0), _lastChar(0), _designSize(0), _ascent(0), _descent(0) { if (!is) return; is.seekg(0); StreamReader reader(is); - UInt16 lf = UInt16(reader.readUnsigned(2)); // length of entire file in 4 byte words - UInt16 lh = UInt16(reader.readUnsigned(2)); // length of header in 4 byte words - _firstChar= UInt16(reader.readUnsigned(2)); // smallest character code in font - _lastChar = UInt16(reader.readUnsigned(2)); // largest character code in font - UInt16 nw = UInt16(reader.readUnsigned(2)); // number of words in width table - UInt16 nh = UInt16(reader.readUnsigned(2)); // number of words in height table - UInt16 nd = UInt16(reader.readUnsigned(2)); // number of words in depth table - UInt16 ni = UInt16(reader.readUnsigned(2)); // number of words in italic corr. table - UInt16 nl = UInt16(reader.readUnsigned(2)); // number of words in lig/kern table - UInt16 nk = UInt16(reader.readUnsigned(2)); // number of words in kern table - UInt16 ne = UInt16(reader.readUnsigned(2)); // number of words in ext. char table - UInt16 np = UInt16(reader.readUnsigned(2)); // number of font parameter words + uint16_t lf = uint16_t(reader.readUnsigned(2)); // length of entire file in 4 byte words + uint16_t lh = uint16_t(reader.readUnsigned(2)); // length of header in 4 byte words + _firstChar= uint16_t(reader.readUnsigned(2)); // smallest character code in font + _lastChar = uint16_t(reader.readUnsigned(2)); // largest character code in font + uint16_t nw = uint16_t(reader.readUnsigned(2)); // number of words in width table + uint16_t nh = uint16_t(reader.readUnsigned(2)); // number of words in height table + uint16_t nd = uint16_t(reader.readUnsigned(2)); // number of words in depth table + uint16_t ni = uint16_t(reader.readUnsigned(2)); // number of words in italic corr. table + uint16_t nl = uint16_t(reader.readUnsigned(2)); // number of words in lig/kern table + uint16_t nk = uint16_t(reader.readUnsigned(2)); // number of words in kern table + uint16_t ne = uint16_t(reader.readUnsigned(2)); // number of words in ext. char table + uint16_t np = uint16_t(reader.readUnsigned(2)); // number of font parameter words if (6+lh+(_lastChar-_firstChar+1)+nw+nh+nd+ni+nl+nk+ne+np != lf) throw FontMetricException("inconsistent length values"); @@ -82,7 +76,7 @@ TFM::TFM (istream &is) : _checksum(0), _firstChar(0), _lastChar(0), _designSize( void TFM::readHeader (StreamReader &reader) { _checksum = reader.readUnsigned(4); - _designSize = fix2double(reader.readUnsigned(4))*Length::pt2bp; + _designSize = double(FixWord(reader.readUnsigned(4)))*Length::pt2bp; } @@ -92,6 +86,10 @@ void TFM::readTables (StreamReader &reader, int nw, int nh, int nd, int ni) { read_words(reader, _heightTable, nh); read_words(reader, _depthTable, nd); read_words(reader, _italicTable, ni); + for (FixWord h : _heightTable) + _ascent = max(_ascent, h); + for (FixWord d : _depthTable) + _descent = max(_descent, d); } @@ -110,25 +108,27 @@ void TFM::readParameters (StreamReader &reader, int np) { /** Returns the optimal space width between words (in PS point units). */ double TFM::getSpace () const { - return _params.empty() ? 0 : fix2double(_params[1])*_designSize; + return _params.empty() ? 0 : double(_params[1])*_designSize; } /** Returns the amount of glue stretching between words (in PS point units). */ double TFM::getSpaceStretch () const { - return _params.empty() ? 0 : fix2double(_params[2])*_designSize; + return _params.empty() ? 0 : double(_params[2])*_designSize; } /** Returns the amount of glue shrinking between words (in PS point units). */ double TFM::getSpaceShrink () const { - return _params.empty() ? 0 : fix2double(_params[3])*_designSize; + return _params.empty() ? 0 : double(_params[3])*_designSize; } /** Returns the size of one EM unit (in PS point units). */ double TFM::getQuad () const { - return _params.empty() ? 0 : fix2double(_params[5])*_designSize; + if (_params.empty() || _params[5] == 0) + return _designSize; + return double(_params[5])*_designSize; } @@ -156,7 +156,7 @@ double TFM::getCharWidth (int c) const { if (index < 0) return 0; index = (_charInfoTable[index] >> 24) & 0xFF; - return fix2double(_widthTable[index]) * _designSize; + return double(_widthTable[index]) * _designSize; } @@ -166,7 +166,7 @@ double TFM::getCharHeight (int c) const { if (index < 0) return 0; index = (_charInfoTable[index] >> 20) & 0x0F; - return fix2double(_heightTable[index]) * _designSize; + return double(_heightTable[index]) * _designSize; } @@ -176,7 +176,7 @@ double TFM::getCharDepth (int c) const { if (index < 0) return 0; index = (_charInfoTable[index] >> 16) & 0x0F; - return fix2double(_depthTable[index]) * _designSize; + return double(_depthTable[index]) * _designSize; } @@ -186,5 +186,5 @@ double TFM::getItalicCorr (int c) const { if (index < 0) return 0; index = (_charInfoTable[index] >> 10) & 0x3F; - return fix2double(_italicTable[index]) * _designSize; + return double(_italicTable[index]) * _designSize; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.hpp index d4136f20d17..495b051eb89 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** TFM.h ** +** TFM.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,15 +18,15 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_TFM_H -#define DVISVGM_TFM_H +#ifndef TFM_HPP +#define TFM_HPP #include <istream> #include <string> #include <vector> -#include "FontMetrics.h" -#include "types.h" -#include "StreamReader.h" +#include "FixWord.hpp" +#include "FontMetrics.hpp" +#include "StreamReader.hpp" class StreamReader; @@ -34,19 +34,21 @@ class TFM : public FontMetrics { public: TFM (std::istream &is); - double getCharWidth (int c) const; - double getCharHeight (int c) const; - double getCharDepth (int c) const; - double getItalicCorr (int c) const; - double getDesignSize () const {return _designSize;} - double getSpace () const; - double getSpaceStretch () const; - double getSpaceShrink () const; - double getQuad () const; - bool verticalLayout () const {return false;} - UInt32 getChecksum () const {return _checksum;} - UInt16 firstChar () const {return _firstChar;} - UInt16 lastChar () const {return _lastChar;} + double getCharWidth (int c) const override; + double getCharHeight (int c) const override; + double getCharDepth (int c) const override; + double getItalicCorr (int c) const override; + double getDesignSize () const override {return _designSize;} + double getSpace () const override; + double getSpaceStretch () const override; + double getSpaceShrink () const override; + double getQuad () const override; + double getAscent () const override {return double(_ascent)*_designSize;} + double getDescent () const override {return double(_descent)*_designSize;} + bool verticalLayout () const override {return false;} + uint32_t getChecksum () const override {return _checksum;} + uint16_t firstChar () const override {return _firstChar;} + uint16_t lastChar () const override {return _lastChar;} protected: TFM () : _checksum(0), _firstChar(0), _lastChar(0), _designSize(0), _params(7) {} @@ -57,15 +59,16 @@ class TFM : public FontMetrics void setCharRange (int firstchar, int lastchar) {_firstChar=firstchar; _lastChar=lastchar;} private: - UInt32 _checksum; - UInt16 _firstChar, _lastChar; + uint32_t _checksum; + uint16_t _firstChar, _lastChar; double _designSize; ///< design size of the font in PS points (72bp = 1in) - std::vector<UInt32> _charInfoTable; + std::vector<uint32_t> _charInfoTable; std::vector<FixWord> _widthTable; ///< character widths in design size units std::vector<FixWord> _heightTable; ///< character height in design size units std::vector<FixWord> _depthTable; ///< character depth in design size units std::vector<FixWord> _italicTable; ///< italic corrections in design size units std::vector<FixWord> _params; ///< values of the TFM's param section + FixWord _ascent, _descent; ///< max. height and depth }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp index e3eb030d58d..89ee6174233 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp @@ -2,7 +2,7 @@ ** TensorProductPatch.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,7 +19,7 @@ *************************************************************************/ #include <valarray> -#include "TensorProductPatch.h" +#include "TensorProductPatch.hpp" using namespace std; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.hpp index 6b766dae0e7..c9d2818fc25 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** TensorProductPatch.h ** +** TensorProductPatch.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,17 +18,17 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef TENSORPRODUCTPATCH_H -#define TENSORPRODUCTPATCH_H +#ifndef TENSORPRODUCTPATCH_HPP +#define TENSORPRODUCTPATCH_HPP #include <map> #include <ostream> #include <vector> -#include "Bezier.h" -#include "Color.h" -#include "MessageException.h" -#include "Pair.h" -#include "ShadingPatch.h" +#include "Bezier.hpp" +#include "Color.hpp" +#include "MessageException.hpp" +#include "Pair.hpp" +#include "ShadingPatch.hpp" /** This class represents a single tensor product patch P which is defined by 16 control points @@ -41,26 +41,26 @@ class TensorProductPatch : public ShadingPatch friend class CoonsPatch; public: - TensorProductPatch () : ShadingPatch(Color::RGB_SPACE) {} + TensorProductPatch () : ShadingPatch(Color::ColorSpace::RGB) {} TensorProductPatch (Color::ColorSpace cspace) : ShadingPatch(cspace) {} TensorProductPatch (const PointVec &points, const ColorVec &colors, Color::ColorSpace cspace, int edgeflag, TensorProductPatch *patch); - int psShadingType() const {return 7;} + int psShadingType() const override {return 7;} void setPoints (const DPair points[4][4], int edgeflag, TensorProductPatch *patch); - void setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch); - void setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch); + void setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch) override; + void setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch) override; virtual DPair valueAt (double u, double v) const; Color colorAt (double u, double v) const; - Color averageColor () const; + Color averageColor () const override; void horizontalCurve (double v, Bezier &bezier) const; void verticalCurve (double u, Bezier &bezier) const; - void getBoundaryPath (GraphicsPath<double> &path) const; + void getBoundaryPath (GraphicsPath<double> &path) const override; void subpatch (double u1, double u2, double v1, double v2, TensorProductPatch &patch) const; DPair blossomValue (double u1, double u2, double u3, double v1, double v2, double v3) const; DPair blossomValue (double u[3], double v[3]) const {return blossomValue(u[0], u[1], u[2], v[0], v[1], v[2]);} - void approximate (int gridsize, bool overlap, double delta, Callback &callback) const; - void getBBox (BoundingBox &bbox) const; - int numPoints (int edgeflag) const {return edgeflag == 0 ? 16 : 12;} - int numColors (int edgeflag) const {return edgeflag == 0 ? 4 : 2;} + void approximate (int gridsize, bool overlap, double delta, Callback &callback) const override; + void getBBox (BoundingBox &bbox) const override; + int numPoints (int edgeflag) const override {return edgeflag == 0 ? 16 : 12;} + int numColors (int edgeflag) const override {return edgeflag == 0 ? 4 : 2;} protected: Color averageColor (const Color &c1, const Color &c2, const Color &c3, const Color &c4) const; @@ -84,12 +84,12 @@ class CoonsPatch : public TensorProductPatch CoonsPatch () {} CoonsPatch (Color::ColorSpace cspace) : TensorProductPatch(cspace) {} CoonsPatch (const PointVec &points, const ColorVec &colors, Color::ColorSpace cspace, int edgeflag, CoonsPatch *patch); - int psShadingType() const {return 6;} - virtual void setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch); - virtual void setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch); - virtual DPair valueAt (double u, double v) const; - int numPoints (int edgeflag) const {return edgeflag == 0 ? 12 : 8;} - int numColors (int edgeflag) const {return edgeflag == 0 ? 4 : 2;} + int psShadingType() const override {return 6;} + virtual void setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch) override; + virtual void setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch) override; + virtual DPair valueAt (double u, double v) const override; + int numPoints (int edgeflag) const override {return edgeflag == 0 ? 12 : 8;} + int numColors (int edgeflag) const override {return edgeflag == 0 ? 4 : 2;} }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.cpp index c3527046585..32ebf3a35f8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.cpp @@ -2,7 +2,7 @@ ** Terminal.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,7 +19,7 @@ *************************************************************************/ #include <config.h> -#include "Terminal.h" +#include "Terminal.hpp" #ifdef HAVE_TERMIOS_H #include <termios.h> diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.hpp index 1beeb6f1558..ea8f67e42d1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** Terminal.h ** +** Terminal.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,8 +18,8 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_TERMINAL_H -#define DVISVGM_TERMINAL_H +#ifndef TERMINAL_HPP +#define TERMINAL_HPP #include <ostream> diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp index 3e8a80fc7a0..752b8517fa0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp @@ -2,7 +2,7 @@ ** ToUnicodeMap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,8 +19,8 @@ *************************************************************************/ #include <limits> -#include "ToUnicodeMap.h" -#include "Unicode.h" +#include "ToUnicodeMap.hpp" +#include "Unicode.hpp" using namespace std; @@ -32,10 +32,10 @@ using namespace std; * characters are numbered from 1 to maxIndex. * @param[in] maxIndex largest character index to consider * @return true on success */ -bool ToUnicodeMap::addMissingMappings (UInt32 maxIndex) { +bool ToUnicodeMap::addMissingMappings (uint32_t maxIndex) { bool success=true; // collect Unicode points already in assigned - NumericRanges<UInt32> codepoints; + NumericRanges<uint32_t> codepoints; for (size_t i=0; i < size() && success; i++) codepoints.addRange(rangeAt(i).minval(), rangeAt(i).maxval()); // fill unmapped ranges @@ -57,13 +57,13 @@ bool ToUnicodeMap::addMissingMappings (UInt32 maxIndex) { * @param[in] used_codepoints codepoints already in use * @param[in] ascending if true, increase ucp to look for valid/unused codepoints * @return true on success */ -static bool fix_codepoint (UInt32 &ucp, const NumericRanges<UInt32> &used_codepoints, bool ascending) { - UInt32 start = ucp; +static bool fix_codepoint (uint32_t &ucp, const NumericRanges<uint32_t> &used_codepoints, bool ascending) { + uint32_t start = ucp; while (!Unicode::isValidCodepoint(ucp) && used_codepoints.valueExists(ucp)) { if (ascending) - ucp = (ucp == numeric_limits<UInt32>::max()) ? 0 : ucp+1; + ucp = (ucp == numeric_limits<uint32_t>::max()) ? 0 : ucp+1; else - ucp = (ucp == 0) ? numeric_limits<UInt32>::max() : ucp-1; + ucp = (ucp == 0) ? numeric_limits<uint32_t>::max() : ucp-1; if (ucp == start) // no free Unicode point found return false; } @@ -71,8 +71,8 @@ static bool fix_codepoint (UInt32 &ucp, const NumericRanges<UInt32> &used_codepo } -static bool is_less_or_equal (UInt32 a, UInt32 b) {return a <= b;} -static bool is_greater_or_equal (UInt32 a, UInt32 b) {return a >= b;} +static bool is_less_or_equal (uint32_t a, uint32_t b) {return a <= b;} +static bool is_greater_or_equal (uint32_t a, uint32_t b) {return a >= b;} /** Adds index to Unicode mappings for a given range of character indexes. @@ -82,17 +82,17 @@ static bool is_greater_or_equal (UInt32 a, UInt32 b) {return a >= b;} * @param[in,out] used_ucps Unicode points already in use * @param[in] ascending if true, fill range from lower to upper bound * @return true on success */ -bool ToUnicodeMap::fillRange (UInt32 minIndex, UInt32 maxIndex, UInt32 ucp, NumericRanges<UInt32> &used_ucps, bool ascending) { +bool ToUnicodeMap::fillRange (uint32_t minIndex, uint32_t maxIndex, uint32_t ucp, NumericRanges<uint32_t> &used_ucps, bool ascending) { if (minIndex <= maxIndex) { - UInt32 first=minIndex, last=maxIndex; + uint32_t first=minIndex, last=maxIndex; int inc=1; - bool (*cmp)(UInt32, UInt32) = is_less_or_equal; + bool (*cmp)(uint32_t, uint32_t) = is_less_or_equal; if (!ascending) { swap(first, last); inc = -1; cmp = is_greater_or_equal; } - for (UInt32 i=first; cmp(i, last); i += inc) { + for (uint32_t i=first; cmp(i, last); i += inc) { if (!fix_codepoint(ucp, used_ucps, ascending)) return false; else { diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.hpp index dd8b5f8d67f..f8ffe3bace9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** ToUnicodeMap.h ** +** ToUnicodeMap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,21 +18,21 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef TOUNICODEMAP_H -#define TOUNICODEMAP_H +#ifndef TOUNICODEMAP_HPP +#define TOUNICODEMAP_HPP -#include "NumericRanges.h" -#include "RangeMap.h" +#include "NumericRanges.hpp" +#include "RangeMap.hpp" /** Represents a mapping from character indexes to unicode points. */ class ToUnicodeMap : public RangeMap { public: - bool addMissingMappings (UInt32 maxIndex); + bool addMissingMappings (uint32_t maxIndex); protected: - bool fillRange (UInt32 minIndex, UInt32 maxIndex, UInt32 ucp, NumericRanges<UInt32> &used_ucps, bool ascending); + bool fillRange (uint32_t minIndex, uint32_t maxIndex, uint32_t ucp, NumericRanges<uint32_t> &used_ucps, bool ascending); }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp index 60d877df45a..6e1fcb62940 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp @@ -2,7 +2,7 @@ ** TpicSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -23,13 +23,13 @@ #include <cmath> #include <cstring> #include <sstream> -#include "Color.h" -#include "InputBuffer.h" -#include "InputReader.h" -#include "GraphicsPath.h" -#include "SpecialActions.h" -#include "SVGTree.h" -#include "TpicSpecialHandler.h" +#include "Color.hpp" +#include "InputBuffer.hpp" +#include "InputReader.hpp" +#include "GraphicsPath.hpp" +#include "SpecialActions.hpp" +#include "SVGTree.hpp" +#include "TpicSpecialHandler.hpp" using namespace std; @@ -86,7 +86,7 @@ void TpicSpecialHandler::drawLines (bool stroke, bool fill, double ddist, Specia elem->addAttribute("fill", fill ? color.svgColorString() : "none"); } ostringstream oss; - FORALL(_points, vector<DPair>::iterator, it) { + for (auto it=_points.begin(); it != _points.end(); ++it) { if (it != _points.begin()) oss << ' '; double x = it->x()+actions.getX(); @@ -240,7 +240,9 @@ void TpicSpecialHandler::drawArc (double cx, double cy, double rx, double ry, do } -#define cmd_id(c1,c2) ((c1 << 8) | c2) +static constexpr int cmd_id (int a, int b) { + return (a << 8) | b; +}; bool TpicSpecialHandler::process (const char *prefix, istream &is, SpecialActions &actions) { if (!prefix || strlen(prefix) != 2) @@ -248,10 +250,10 @@ bool TpicSpecialHandler::process (const char *prefix, istream &is, SpecialAction const double mi2bp=0.072; // factor for milli-inch to PS points StreamInputBuffer ib(is); - BufferInputReader in(ib); + BufferInputReader ir(ib); switch (cmd_id(prefix[0], prefix[1])) { case cmd_id('p','n'): // set pen width in milli-inches - _penwidth = in.getDouble()*mi2bp; + _penwidth = ir.getDouble()*mi2bp; break; case cmd_id('b','k'): // set fill color to black _fill = 0; @@ -260,15 +262,15 @@ bool TpicSpecialHandler::process (const char *prefix, istream &is, SpecialAction _fill = 1; break; case cmd_id('s','h'): // set fill color to given gray level - in.skipSpace(); - _fill = in.eof() ? 0.5 : max(0.0, min(1.0, in.getDouble())); + ir.skipSpace(); + _fill = ir.eof() ? 0.5 : max(0.0, min(1.0, ir.getDouble())); break; case cmd_id('t','x'): // set fill pattern break; case cmd_id('p','a'): { // add point to path - double x = in.getDouble()*mi2bp; - double y = in.getDouble()*mi2bp; - _points.push_back(DPair(x,y)); + double x = ir.getDouble()*mi2bp; + double y = ir.getDouble()*mi2bp; + _points.emplace_back(DPair(x,y)); break; } case cmd_id('f','p'): // draw solid lines through recorded points; close and fill path if fill color was defined @@ -278,33 +280,33 @@ bool TpicSpecialHandler::process (const char *prefix, istream &is, SpecialAction drawLines(false, true, 0, actions); break; case cmd_id('d','a'): // as fp but draw dashed lines - drawLines(true, _fill >= 0, in.getDouble()*72, actions); + drawLines(true, _fill >= 0, ir.getDouble()*72, actions); break; case cmd_id('d','t'): // as fp but draw dotted lines - drawLines(true, _fill >= 0, -in.getDouble()*72, actions); + drawLines(true, _fill >= 0, -ir.getDouble()*72, actions); break; case cmd_id('s','p'): { // draw quadratic splines through recorded points - double ddist = in.getDouble(); + double ddist = ir.getDouble(); drawSplines(ddist, actions); break; } case cmd_id('a','r'): { // draw elliptical arc - double cx = in.getDouble()*mi2bp; - double cy = in.getDouble()*mi2bp; - double rx = in.getDouble()*mi2bp; - double ry = in.getDouble()*mi2bp; - double a1 = in.getDouble(); - double a2 = in.getDouble(); + double cx = ir.getDouble()*mi2bp; + double cy = ir.getDouble()*mi2bp; + double rx = ir.getDouble()*mi2bp; + double ry = ir.getDouble()*mi2bp; + double a1 = ir.getDouble(); + double a2 = ir.getDouble(); drawArc(cx, cy, rx, ry, a1, a2, actions); break; } case cmd_id('i','a'): { // fill elliptical arc - double cx = in.getDouble()*mi2bp; - double cy = in.getDouble()*mi2bp; - double rx = in.getDouble()*mi2bp; - double ry = in.getDouble()*mi2bp; - double a1 = in.getDouble(); - double a2 = in.getDouble(); + double cx = ir.getDouble()*mi2bp; + double cy = ir.getDouble()*mi2bp; + double rx = ir.getDouble()*mi2bp; + double ry = ir.getDouble()*mi2bp; + double a1 = ir.getDouble(); + double a2 = ir.getDouble(); if (_fill < 0) _fill = 1; drawArc(cx, cy, rx, ry, a1, a2, actions); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.hpp index a9896cfdb07..ec2ff5d4cde 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** TpicSpecialHandler.h ** +** TpicSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,24 +18,24 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_TPICSPECIALHANDLER_H -#define DVISVGM_TPICSPECIALHANDLER_H +#ifndef TPICSPECIALHANDLER_HPP +#define TPICSPECIALHANDLER_HPP #include <list> -#include "Pair.h" -#include "SpecialHandler.h" +#include "Pair.hpp" +#include "SpecialHandler.hpp" class TpicSpecialHandler : public SpecialHandler, public DVIEndPageListener { public: TpicSpecialHandler (); - const char* info () const {return "TPIC specials";} - const char* name () const {return "tpic";} - const char** prefixes () const; - bool process (const char *prefix, std::istream &is, SpecialActions &actions); + const char* info () const override {return "TPIC specials";} + const char* name () const override {return "tpic";} + const char** prefixes () const override; + bool process (const char *prefix, std::istream &is, SpecialActions &actions) override; protected: - void dviEndPage (unsigned pageno, SpecialActions &actions); + void dviEndPage (unsigned pageno, SpecialActions &actions) override; void reset (); void drawLines (bool stroke, bool fill, double ddist, SpecialActions &actions); void drawSplines (double ddist, SpecialActions &actions); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp index 75bb69a27d6..7d38a5edfc8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp @@ -2,7 +2,7 @@ ** TriangularPatch.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,7 +18,7 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#include "TriangularPatch.h" +#include "TriangularPatch.hpp" using namespace std; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.hpp index e63c5cdfd41..c37f94d0f11 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** TriangularPatch.h ** +** TriangularPatch.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,12 +18,12 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_TRIANGULARPATCH_H -#define DVISVGM_TRIANGULARPATCH_H +#ifndef TRIANGULARPATCH_HPP +#define TRIANGULARPATCH_HPP -#include "Color.h" -#include "Pair.h" -#include "ShadingPatch.h" +#include "Color.hpp" +#include "Pair.hpp" +#include "ShadingPatch.hpp" class TriangularPatch : public ShadingPatch { @@ -31,19 +31,19 @@ class TriangularPatch : public ShadingPatch TriangularPatch (); TriangularPatch (Color::ColorSpace cspace) : ShadingPatch(cspace) {} TriangularPatch (const PointVec &points, const ColorVec &colors, Color::ColorSpace cspace, int edgeflag, TriangularPatch *patch); - int psShadingType() const {return 4;} + int psShadingType() const override {return 4;} DPair valueAt (double u, double v) const; Color colorAt (double u, double v) const; - Color averageColor() const; - void setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch); + Color averageColor() const override; + void setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch) override; void setPoints (const DPair &p1, const DPair &p2, const DPair &p3); - void setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch); + void setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch) override; void setColors (const Color &c1, const Color &c2, const Color &c3); - void approximate (int gridsize, bool overlap, double delta, Callback &listener) const; - void getBBox (BoundingBox &bbox) const; - void getBoundaryPath(GraphicsPath<double> &path) const; - int numPoints (int edgeflag) const {return edgeflag == 0 ? 3 : 1;} - int numColors (int edgeflag) const {return edgeflag == 0 ? 3 : 1;} + void approximate (int gridsize, bool overlap, double delta, Callback &listener) const override; + void getBBox (BoundingBox &bbox) const override; + void getBoundaryPath(GraphicsPath<double> &path) const override; + int numPoints (int edgeflag) const override {return edgeflag == 0 ? 3 : 1;} + int numColors (int edgeflag) const override {return edgeflag == 0 ? 3 : 1;} protected: Color averageColor (const Color &c1, const Color &c2, const Color &c3) const; @@ -58,7 +58,7 @@ class LatticeTriangularPatch : public TriangularPatch { public: LatticeTriangularPatch (Color::ColorSpace cspace) : TriangularPatch(cspace) {} - int psShadingType() const {return 5;} + int psShadingType() const override {return 5;} }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.cpp index 6a55fa2e246..efb6122e2a7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.cpp @@ -2,7 +2,7 @@ ** Unicode.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,12 +18,13 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#include <xxhash.h> +#include <algorithm> #include <cctype> #include <cstddef> #include <iomanip> #include <sstream> -#include "Unicode.h" +#include <xxhash.h> +#include "Unicode.hpp" using namespace std; @@ -31,18 +32,18 @@ using namespace std; /** Returns true if c is a valid Unicode point in XML documents. * XML version 1.0 doesn't allow various Unicode character references * ( for example). */ -bool Unicode::isValidCodepoint (UInt32 c) { +bool Unicode::isValidCodepoint (uint32_t c) { if ((c & 0xffff) == 0xfffe || (c & 0xffff) == 0xffff) return false; - UInt32 ranges[] = { + uint32_t ranges[] = { 0x0000, 0x0020, // basic control characters + space 0x007f, 0x009f, // use of control characters is discouraged by the XML standard 0x202a, 0x202e, // bidi control characters 0xd800, 0xdfff, // High Surrogates are not allowed in XML 0xfdd0, 0xfdef, // non-characters for internal use by applications }; - for (size_t i=0; i < sizeof(ranges)/sizeof(UInt32) && c >= ranges[i]; i+=2) + for (size_t i=0; i < sizeof(ranges)/sizeof(uint32_t) && c >= ranges[i]; i+=2) if (c <= ranges[i+1]) return false; return true; @@ -52,8 +53,8 @@ bool Unicode::isValidCodepoint (UInt32 c) { /** Returns a valid Unicode point for the given character code. Character codes * that are invalid code points because the XML standard forbids or discourages * their usage, are mapped to the Private Use Zone U+E000-U+F8FF. */ -UInt32 Unicode::charToCodepoint (UInt32 c) { - UInt32 ranges[] = { +uint32_t Unicode::charToCodepoint (uint32_t c) { + uint32_t ranges[] = { 0x0000, 0x0020, 0xe000, // basic control characters + space 0x007f, 0x009f, 0xe021, // use of control characters is discouraged by the XML standard 0x202a, 0x202e, 0xe042, // bidi control characters @@ -87,7 +88,7 @@ UInt32 Unicode::charToCodepoint (UInt32 c) { /** Converts a Unicode point to a UTF-8 byte sequence. * @param[in] cp code point * @return utf8 sequence consisting of 1-4 bytes */ -string Unicode::utf8 (Int32 cp) { +string Unicode::utf8 (int32_t cp) { string utf8; if (cp >= 0) { if (cp < 0x80) @@ -112,20 +113,16 @@ string Unicode::utf8 (Int32 cp) { return utf8; } -#include "AGLTable.h" - -static inline bool is_hex_digit (char c) { - return isdigit(c) || (c >= 'A' && c <= 'F'); -} - +#include "AGLTable.hpp" /** Tries to extract the codepoint from AGL character names like "uni1234" or "u1234". * Returns 0 if the given name doesn't satisfy the constraints. * https://github.com/adobe-type-tools/agl-specification * @param[in] name AGL character name * @return the extracted codepoint or 0 on failure */ -static Int32 extract_codepoint_from_name (const string &name) { +static int32_t extract_codepoint_from_name (const string &name) { size_t offset=1; + auto is_hex_digit = [](char c) {return isdigit(c) || (c >= 'A' && c <= 'F');}; if (name.substr(0, 3) == "uni" && is_hex_digit(name[4]) && name.length() >= 7) offset = 3; else if (name[0] != 'u' || !is_hex_digit(name[1]) || name.length() < 5) @@ -142,7 +139,7 @@ static Int32 extract_codepoint_from_name (const string &name) { return 0; if (offset == 3) hexstr = hexstr.substr(0, 4); - Int32 codepoint; + int32_t codepoint; istringstream iss(hexstr); iss >> hex >> codepoint; if (!iss.fail() && (codepoint <= 0xD7FF || (codepoint >= 0xE000 && codepoint <= 0x10FFFF))) @@ -172,21 +169,18 @@ static const char* get_suffix (const string &name) { /** Returns the Unicode point for a given AGL character name. * @param name AGL name of the character to look up * @return codepoint of the character */ -Int32 Unicode::aglNameToCodepoint (const string &name) { - if (Int32 cp = extract_codepoint_from_name(name)) +int32_t Unicode::aglNameToCodepoint (const string &name) { + if (int32_t cp = extract_codepoint_from_name(name)) return cp; - UInt32 hash = XXH32(&name[0], name.length(), 0); - int left=0; - int right=sizeof(hash2unicode)/sizeof(Hash2Unicode)-1; - while (left <= right) { - int mid = left+(right-left)/2; - if (hash == hash2unicode[mid].hash) - return hash2unicode[mid].codepoint; - if (hash < hash2unicode[mid].hash) - right = mid-1; - else - left = mid+1; - } + uint32_t hash = XXH32(&name[0], name.length(), 0); + const HashCodepointPair cmppair = {hash, 0}; + auto it = lower_bound(hash2unicode.begin(), hash2unicode.end(), cmppair, + [](const HashCodepointPair &p1, const HashCodepointPair &p2) { + return p1.hash < p2.hash; + } + ); + if (it != hash2unicode.end() && it->hash == hash) + return it->codepoint; return 0; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.hpp index 8b25b4193c1..b44ed6e1a67 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** Unicode.h ** +** Unicode.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,18 +18,17 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_UNICODE_H -#define DVISVGM_UNICODE_H +#ifndef UNICODE_HPP +#define UNICODE_HPP #include <string> -#include "types.h" struct Unicode { - static bool isValidCodepoint (UInt32 code); - static UInt32 charToCodepoint (UInt32 c); - static std::string utf8 (Int32 c); - static Int32 aglNameToCodepoint (const std::string &name); + static bool isValidCodepoint (uint32_t code); + static uint32_t charToCodepoint (uint32_t c); + static std::string utf8 (int32_t c); + static int32_t aglNameToCodepoint (const std::string &name); }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFActions.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFActions.hpp index 13add6d2e0d..d9816a12aa5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFActions.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFActions.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** VFActions.h ** +** VFActions.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,21 +18,20 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_VFACTIONS_H -#define DVISVGM_VFACTIONS_H +#ifndef VFACTIONS_HPP +#define VFACTIONS_HPP #include <string> #include <vector> -#include "types.h" struct VFActions { - virtual ~VFActions () {} - virtual void preamble (std::string comment, UInt32 checksum, double dsize) {} - virtual void postamble () {} - virtual void defineVFFont (UInt32 fontnum, std::string path, std::string name, UInt32 checksum, double dsize, double ssize) {} - virtual void defineVFChar (UInt32 c, std::vector<UInt8> *dvi) {} + virtual ~VFActions () =default; + virtual void vfPreamble (const std::string &comment, uint32_t checksum, double dsize) {} + virtual void vfPostamble () {} + virtual void defineVFFont (uint32_t fontnum, const std::string &path, const std::string &name, uint32_t checksum, double dsize, double ssize) {} + virtual void defineVFChar (uint32_t c, std::vector<uint8_t> &&dvi) {} }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.cpp index 3998b7146a1..f8a93932316 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.cpp @@ -2,7 +2,7 @@ ** VFReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -20,20 +20,15 @@ #include <config.h> #include <sstream> -#include "Font.h" -#include "Length.h" -#include "VFActions.h" -#include "VFReader.h" +#include "FixWord.hpp" +#include "Font.hpp" +#include "Length.hpp" +#include "VFActions.hpp" +#include "VFReader.hpp" using namespace std; -/** Converts a TFM fix point value to double (PS point units). */ -static inline double fix2double (FixWord fix) { - return double(fix)/(1 << 20)*Length::pt2bp; -} - - VFReader::VFReader (istream &is) : StreamReader(is), _actions(0), _designSize(0) { } @@ -97,16 +92,12 @@ bool VFReader::executeAll () { } -/// Returns true if op indicates the preamble or a font definition -static bool is_pre_or_fontdef (int op) {return op > 242;} -static bool is_chardef (int op) {return op < 243;} - - bool VFReader::executePreambleAndFontDefs () { clearStream(); if (!isStreamValid()) return false; seek(0); // move file pointer to first byte of the input stream + auto is_pre_or_fontdef = [](int op) {return op > 242;}; while (!eof() && executeCommand(is_pre_or_fontdef) > 242); // stop reading after last font definition return true; } @@ -117,6 +108,7 @@ bool VFReader::executeCharDefs () { if (!isStreamValid()) return false; seek(0); + auto is_chardef = [](int op) {return op < 243;}; while (!eof() && executeCommand(is_chardef) < 243); // stop reading after last char definition return true; } @@ -125,36 +117,36 @@ bool VFReader::executeCharDefs () { /** Reads and executes DVI preamble command. */ void VFReader::cmdPre () { - UInt32 i = readUnsigned(1); // identification number (should be 2) - UInt32 k = readUnsigned(1); // length of following comment + uint32_t i = readUnsigned(1); // identification number (should be 2) + uint32_t k = readUnsigned(1); // length of following comment string cmt = readString(k); // comment - UInt32 cs = readUnsigned(4); // check sum to be compared with TFM cecksum - UInt32 ds = readUnsigned(4); // design size (same as TFM design size) (fix_word) - _designSize = fix2double(ds); + uint32_t cs = readUnsigned(4); // check sum to be compared with TFM cecksum + int32_t ds = readUnsigned(4); // design size (same as TFM design size) (fix_word) + _designSize = double(FixWord(ds))*Length::pt2bp; if (i != 202) throw VFException("invalid identification value in preamble"); if (_actions) - _actions->preamble(cmt, cs, ds); + _actions->vfPreamble(cmt, cs, ds); } void VFReader::cmdPost () { while ((readUnsigned(1)) == 248); // skip fill bytes if (_actions) - _actions->postamble(); + _actions->vfPostamble(); } void VFReader::cmdLongChar () { - UInt32 pl = readUnsigned(4); // packet length (length of DVI subroutine) + uint32_t pl = readUnsigned(4); // packet length (length of DVI subroutine) if (!_actions) seek(8+pl, ios::cur); // skip remaining char definition bytes else { - UInt32 cc = readUnsigned(4); // character code - readUnsigned(4); // character width from corresponding TFM file - vector<UInt8> *dvi = new vector<UInt8>(pl); // DVI subroutine - readBytes(pl, *dvi); - _actions->defineVFChar(cc, dvi); // call template method for user actions + uint32_t cc = readUnsigned(4); // character code + readUnsigned(4); // equals character width from corresponding TFM file + vector<uint8_t> dvi(pl); // DVI subroutine + readBytes(pl, dvi); + _actions->defineVFChar(cc, std::move(dvi)); // call template method for user actions } } @@ -163,29 +155,29 @@ void VFReader::cmdLongChar () { * @param[in] pl packet length (length of DVI subroutine) */ void VFReader::cmdShortChar (int pl) { if (!_actions) - seek(4+pl, ios::cur); // skip char definition bytes + seek(4+pl, ios::cur); // skip char definition bytes else { - UInt32 cc = readUnsigned(1); // character code + uint32_t cc = readUnsigned(1); // character code readUnsigned(3); // character width from corresponding TFM file - vector<UInt8> *dvi = new vector<UInt8>(pl); // DVI subroutine - readBytes(pl, *dvi); - _actions->defineVFChar(cc, dvi); // call template method for user actions + vector<uint8_t> dvi(pl); // DVI subroutine + readBytes(pl, dvi); + _actions->defineVFChar(cc, std::move(dvi)); // call template method for user actions } } void VFReader::cmdFontDef (int len) { - UInt32 fontnum = readUnsigned(len); // font number - UInt32 checksum = readUnsigned(4); // font checksum (to be compared with corresponding TFM checksum) - UInt32 ssize = readUnsigned(4); // scaled size of font relative to design size (fix_word) - UInt32 dsize = readUnsigned(4); // design size of font (same as TFM design size) (fix_word) - UInt32 pathlen = readUnsigned(1); // length of font path - UInt32 namelen = readUnsigned(1); // length of font name + uint32_t fontnum = readUnsigned(len); // font number + uint32_t checksum = readUnsigned(4); // font checksum (to be compared with corresponding TFM checksum) + uint32_t ssize = readUnsigned(4); // scaled size of font relative to design size (fix_word) + uint32_t dsize = readUnsigned(4); // design size of font (same as TFM design size) (fix_word) + uint32_t pathlen = readUnsigned(1); // length of font path + uint32_t namelen = readUnsigned(1); // length of font name string fontpath = readString(pathlen); string fontname = readString(namelen); if (_actions) { - double ss = fix2double(ssize); - double ds = fix2double(dsize); + double ss = double(FixWord(ssize))*Length::pt2bp; + double ds = double(FixWord(dsize))*Length::pt2bp; _actions->defineVFFont(fontnum, fontpath, fontname, checksum, ds, ss*_designSize); } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.hpp index 2300493bc64..69664c43474 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** VFReader.h ** +** VFReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,12 +18,11 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_VFREADER_H -#define DVISVGM_VFREADER_H +#ifndef VFREADER_HPP +#define VFREADER_HPP -#include "MessageException.h" -#include "StreamReader.h" -#include "types.h" +#include "MessageException.hpp" +#include "StreamReader.hpp" struct VFException : public MessageException @@ -59,7 +58,7 @@ class VFReader : public StreamReader private: VFActions *_actions; ///< actions to execute when reading a VF command - double _designSize; ///< design size of currently read VF + double _designSize; ///< design size of currently read VF in PS points }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorIterator.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorIterator.hpp index 864fddf31bf..41837e90be3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorIterator.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorIterator.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** VectorIterator.h ** +** VectorIterator.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,11 +18,11 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef VECTORITERATOR_H -#define VECTORITERATOR_H +#ifndef VECTORITERATOR_HPP +#define VECTORITERATOR_HPP #include <vector> -#include "MessageException.h" +#include "MessageException.hpp" struct IteratorException : public MessageException diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorStream.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorStream.hpp index a6bfeed562d..5b5512e59bf 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorStream.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorStream.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** VectorStream.h ** +** VectorStream.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,8 +18,8 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_VECTORSTREAM_H -#define DVISVGM_VECTORSTREAM_H +#ifndef VECTORSTREAM_HPP +#define VECTORSTREAM_HPP #include <istream> #include <vector> @@ -31,17 +31,17 @@ class VectorStreamBuffer : public std::streambuf VectorStreamBuffer (const std::vector<T> &v) : _begin(&v[0]), _end(&v[0]+v.size()), _curr(&v[0]) {} protected: - int_type underflow () {return _curr == _end ? traits_type::eof() : traits_type::to_int_type(*_curr);} - int_type uflow() {return _curr == _end ? traits_type::eof() : traits_type::to_int_type(*_curr++);} - std::streamsize showmanyc () {return _end-_curr;} + int_type underflow () override {return _curr == _end ? traits_type::eof() : traits_type::to_int_type(*_curr);} + int_type uflow() override {return _curr == _end ? traits_type::eof() : traits_type::to_int_type(*_curr++);} + std::streamsize showmanyc () override {return _end-_curr;} - int_type pbackfail (int_type c) { + int_type pbackfail (int_type c) override { if (_curr == _begin || (c != traits_type::eof() && c != _curr[-1])) return traits_type::eof(); return traits_type::to_int_type(*--_curr); } - pos_type seekoff (off_type off, std::ios_base::seekdir dir, std::ios_base::openmode which=std::ios_base::in) { + pos_type seekoff (off_type off, std::ios_base::seekdir dir, std::ios_base::openmode which=std::ios_base::in) override { switch (dir) { case std::ios_base::cur: _curr += off; break; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.cpp index 6b43d717090..2b539924025 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.cpp @@ -2,7 +2,7 @@ ** XMLDocument.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,8 +19,7 @@ *************************************************************************/ #include <config.h> -#include "macros.h" -#include "XMLDocument.h" +#include "XMLDocument.hpp" using namespace std; @@ -30,44 +29,32 @@ XMLDocument::XMLDocument (XMLElementNode *root) } -XMLDocument::~XMLDocument () { - clear(); -} - - void XMLDocument::clear () { - delete _rootElement; - _rootElement = 0; - FORALL(_nodes, list<XMLNode*>::iterator, i) - delete *i; + _rootElement.reset(); _nodes.clear(); } void XMLDocument::append (XMLNode *node) { - if (!node) - return; - if (XMLElementNode *newRoot = dynamic_cast<XMLElementNode*>(node)) { - // there can only be one root element node in the document - delete _rootElement; // so if there is already one... - _rootElement = newRoot; // ...we replace it + if (node) { + if (XMLElementNode *newRoot = dynamic_cast<XMLElementNode*>(node)) + _rootElement.reset(newRoot); + else + _nodes.emplace_back(unique_ptr<XMLNode>(node)); } - else - _nodes.push_back(node); } void XMLDocument::setRootNode (XMLElementNode *root) { - delete _rootElement; - _rootElement = root; + _rootElement.reset(root); } ostream& XMLDocument::write (ostream &os) const { if (_rootElement) { // no root element => no output os << "<?xml version='1.0' encoding='UTF-8'?>\n"; - FORALL(_nodes, list<XMLNode*>::const_iterator, i) { - (*i)->write(os); + for (const auto &node : _nodes) { + node->write(os); os << '\n'; } _rootElement->write(os); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.hpp index f31505ccd6c..d8590b8b35f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** XMLDocument.h ** +** XMLDocument.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,25 +18,25 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_XMLDOCUMENT_H -#define DVISVGM_XMLDOCUMENT_H +#ifndef XMLDOCUMENT_HPP +#define XMLDOCUMENT_HPP -#include "XMLNode.h" +#include <memory> +#include "XMLNode.hpp" class XMLDocument { public: XMLDocument (XMLElementNode *root=0); - ~XMLDocument (); void clear (); void append (XMLNode *node); void setRootNode (XMLElementNode *root); - const XMLElementNode* getRootElement () const {return _rootElement;} + const XMLElementNode* getRootElement () const {return _rootElement.get();} std::ostream& write (std::ostream &os) const; private: - std::list<XMLNode*> _nodes; - XMLElementNode *_rootElement; + std::list<std::unique_ptr<XMLNode>> _nodes; + std::unique_ptr<XMLElementNode> _rootElement; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp index ed12f9e1814..8e9b8a76469 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp @@ -2,7 +2,7 @@ ** XMLNode.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -22,9 +22,8 @@ #include <map> #include <list> #include <sstream> -#include "macros.h" -#include "XMLNode.h" -#include "XMLString.h" +#include "XMLNode.hpp" +#include "XMLString.hpp" using namespace std; @@ -36,25 +35,14 @@ XMLElementNode::XMLElementNode (const string &n) : _name(n) { XMLElementNode::XMLElementNode (const XMLElementNode &node) : _name(node._name), _attributes(node._attributes) { - FORALL(node._children, ChildList::const_iterator, it) - _children.push_back((*it)->clone()); -} - - -XMLElementNode::~XMLElementNode () { - while (!_children.empty()) { - delete _children.back(); - _children.pop_back(); - } + for (const auto &child : node._children) + _children.emplace_back(unique_ptr<XMLNode>(child->clone())); } void XMLElementNode::clear () { _attributes.clear(); - while (!_children.empty()) { - delete _children.back(); - _children.pop_back(); - } + _children.clear(); } @@ -73,21 +61,21 @@ void XMLElementNode::append (XMLNode *child) { return; XMLTextNode *textNode1 = dynamic_cast<XMLTextNode*>(child); if (!textNode1 || _children.empty()) - _children.push_back(child); + _children.emplace_back(unique_ptr<XMLNode>(child)); else { - if (XMLTextNode *textNode2 = dynamic_cast<XMLTextNode*>(_children.back())) + if (XMLTextNode *textNode2 = dynamic_cast<XMLTextNode*>(_children.back().get())) textNode2->append(textNode1); // merge two consecutive text nodes else - _children.push_back(child); + _children.emplace_back(unique_ptr<XMLNode>(child)); } } void XMLElementNode::append (const string &str) { - if (_children.empty() || !dynamic_cast<XMLTextNode*>(_children.back())) - _children.push_back(new XMLTextNode(str)); + if (_children.empty() || !dynamic_cast<XMLTextNode*>(_children.back().get())) + _children.emplace_back(unique_ptr<XMLNode>(new XMLTextNode(str))); else - static_cast<XMLTextNode*>(_children.back())->append(str); + static_cast<XMLTextNode*>(_children.back().get())->append(str); } @@ -96,12 +84,12 @@ void XMLElementNode::prepend (XMLNode *child) { return; XMLTextNode *textNode1 = dynamic_cast<XMLTextNode*>(child); if (!textNode1 || _children.empty()) - _children.push_front(child); + _children.emplace_front(unique_ptr<XMLNode>(child)); else { - if (XMLTextNode *textNode2 = dynamic_cast<XMLTextNode*>(_children.front())) + if (XMLTextNode *textNode2 = dynamic_cast<XMLTextNode*>(_children.front().get())) textNode2->prepend(textNode1); // merge two consecutive text nodes else - _children.push_front(child); + _children.emplace_front(unique_ptr<XMLNode>(child)); } } @@ -114,11 +102,11 @@ void XMLElementNode::prepend (XMLNode *child) { * @return true on success */ bool XMLElementNode::insertBefore (XMLNode *child, XMLNode *sibling) { ChildList::iterator it = _children.begin(); - while (it != _children.end() && *it != sibling) + while (it != _children.end() && it->get() != sibling) ++it; if (it == _children.end()) return false; - _children.insert(it, child); + _children.emplace(it, unique_ptr<XMLNode>(child)); return true; } @@ -131,23 +119,31 @@ bool XMLElementNode::insertBefore (XMLNode *child, XMLNode *sibling) { * @return true on success */ bool XMLElementNode::insertAfter (XMLNode *child, XMLNode *sibling) { ChildList::iterator it = _children.begin(); - while (it != _children.end() && *it != sibling) + while (it != _children.end() && it->get() != sibling) ++it; if (it == _children.end()) return false; - _children.insert(++it, child); + _children.emplace(++it, unique_ptr<XMLNode>(child)); return true; } +/** Removes a given child from the element. */ +void XMLElementNode::remove (const XMLNode *child) { + _children.remove_if([=](const unique_ptr<XMLNode> &ptr) { + return ptr.get() == child; + }); +} + + /** Gets all descendant elements with a given name and given attribute. * @param[in] name name of elements to find * @param[in] attrName name of attribute to find * @param[out] descendants all elements found * @return true if at least one element was found */ bool XMLElementNode::getDescendants (const char *name, const char *attrName, vector<XMLElementNode*> &descendants) const { - FORALL(_children, ChildList::const_iterator, it) { - if (XMLElementNode *elem = dynamic_cast<XMLElementNode*>(*it)) { + for (auto &child : _children) { + if (XMLElementNode *elem = dynamic_cast<XMLElementNode*>(child.get())) { if ((!name || elem->getName() == name) && (!attrName || elem->hasAttribute(attrName))) descendants.push_back(elem); elem->getDescendants(name, attrName, descendants); @@ -163,8 +159,8 @@ bool XMLElementNode::getDescendants (const char *name, const char *attrName, vec * @param[in] attrValue if not 0, only elements with attribute attrName="attrValue" are considered * @return pointer to the found element or 0 */ XMLElementNode* XMLElementNode::getFirstDescendant (const char *name, const char *attrName, const char *attrValue) const { - FORALL(_children, ChildList::const_iterator, it) { - if (XMLElementNode *elem = dynamic_cast<XMLElementNode*>(*it)) { + for (auto &child : _children) { + if (XMLElementNode *elem = dynamic_cast<XMLElementNode*>(child.get())) { if (!name || elem->getName() == name) { const char *value; if (!attrName || (((value = elem->getAttributeValue(attrName)) != 0) && (!attrValue || string(value) == attrValue))) @@ -180,21 +176,21 @@ XMLElementNode* XMLElementNode::getFirstDescendant (const char *name, const char ostream& XMLElementNode::write (ostream &os) const { os << '<' << _name; - FORALL(_attributes, AttribMap::const_iterator, it) - os << ' ' << it->first << "='" << it->second << '\''; + for (const auto &attrib : _attributes) + os << ' ' << attrib.first << "='" << attrib.second << '\''; if (_children.empty()) os << "/>"; else { os << '>'; // Insert newlines around children except text nodes. According to the // SVG specification, pure whitespace nodes are ignored by the SVG renderer. - if (!dynamic_cast<XMLTextNode*>(_children.front())) + if (!dynamic_cast<XMLTextNode*>(_children.front().get())) os << '\n'; - FORALL(_children, ChildList::const_iterator, it) { + for (auto it=_children.begin(); it != _children.end(); ++it) { (*it)->write(os); - if (!dynamic_cast<XMLTextNode*>(*it)) { - ChildList::const_iterator next=it; - if (++next == _children.end() || !dynamic_cast<XMLTextNode*>(*next)) + if (!dynamic_cast<XMLTextNode*>(it->get())) { + auto next=it; + if (++next == _children.end() || !dynamic_cast<XMLTextNode*>(next->get())) os << '\n'; } } @@ -268,3 +264,9 @@ ostream& XMLCDataNode::write (ostream &os) const { } +void XMLCDataNode::append (string &&str) { + if (_data.empty()) + _data = move(str); + else + _data += str; +}
\ No newline at end of file diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.hpp index db45152dde9..698b4b43205 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** XMLNode.h ** +** XMLNode.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,11 +18,12 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_XMLNODE_H -#define DVISVGM_XMLNODE_H +#ifndef XMLNODE_HPP +#define XMLNODE_HPP #include <list> #include <map> +#include <memory> #include <ostream> #include <string> #include <vector> @@ -31,7 +32,7 @@ class XMLNode { public: - virtual ~XMLNode () {} + virtual ~XMLNode () =default; virtual XMLNode* clone () const =0; virtual void clear () =0; virtual std::ostream& write (std::ostream &os) const =0; @@ -40,30 +41,31 @@ class XMLNode class XMLElementNode : public XMLNode { - typedef std::map<std::string,std::string> AttribMap; - typedef std::list<XMLNode*> ChildList; + public: + typedef std::map<std::string,std::string> AttribMap; + typedef std::list<std::unique_ptr<XMLNode>> ChildList; + public: XMLElementNode (const std::string &name); XMLElementNode (const XMLElementNode &node); - ~XMLElementNode (); - XMLElementNode* clone () const {return new XMLElementNode(*this);} - void clear (); + XMLElementNode* clone () const override {return new XMLElementNode(*this);} + void clear () override; void addAttribute (const std::string &name, const std::string &value); void addAttribute (const std::string &name, double value); void append (XMLNode *child); void append (const std::string &str); void prepend (XMLNode *child); - void remove (XMLNode *child) {_children.remove(child);} + void remove (const XMLNode *child); bool insertAfter (XMLNode *child, XMLNode *sibling); bool insertBefore (XMLNode *child, XMLNode *sibling); bool hasAttribute (const std::string &name) const; const char* getAttributeValue (const std::string &name) const; bool getDescendants (const char *name, const char *attrName, std::vector<XMLElementNode*> &descendants) const; XMLElementNode* getFirstDescendant (const char *name, const char *attrName, const char *attrValue) const; - std::ostream& write (std::ostream &os) const; - bool empty () const {return _children.empty();} - const std::list<XMLNode*>& children () const {return _children;} - const std::string& getName () const {return _name;} + std::ostream& write (std::ostream &os) const override; + bool empty () const {return _children.empty();} + const ChildList& children () const {return _children;} + const std::string& getName () const {return _name;} private: std::string _name; // element name (<name a1="v1" .. an="vn">...</name>) @@ -76,13 +78,14 @@ class XMLTextNode : public XMLNode { public: XMLTextNode (const std::string &str) : _text(str) {} - XMLTextNode* clone () const {return new XMLTextNode(*this);} - void clear () {_text.clear();} + XMLTextNode (std::string &&str) : _text(std::move(str)) {} + XMLTextNode* clone () const override {return new XMLTextNode(*this);} + void clear () override {_text.clear();} void append (XMLNode *node); void append (XMLTextNode *node); void append (const std::string &str); void prepend (XMLNode *child); - std::ostream& write (std::ostream &os) const {return os << _text;} + std::ostream& write (std::ostream &os) const override {return os << _text;} const std::string& getText () const {return _text;} private: @@ -94,9 +97,10 @@ class XMLCommentNode : public XMLNode { public: XMLCommentNode (const std::string &str) : _text(str) {} - XMLCommentNode* clone () const {return new XMLCommentNode(*this);} - void clear () {_text.clear();} - std::ostream& write (std::ostream &os) const {return os << "<!--" << _text << "-->";} + XMLCommentNode (std::string &&str) : _text(std::move(str)) {} + XMLCommentNode* clone () const override {return new XMLCommentNode(*this);} + void clear () override {_text.clear();} + std::ostream& write (std::ostream &os) const override {return os << "<!--" << _text << "-->";} private: std::string _text; @@ -106,10 +110,13 @@ class XMLCommentNode : public XMLNode class XMLCDataNode : public XMLNode { public: + XMLCDataNode () {} XMLCDataNode (const std::string &d) : _data(d) {} - XMLCDataNode* clone () const {return new XMLCDataNode(*this);} - void clear () {_data.clear();} - std::ostream& write (std::ostream &os) const; + XMLCDataNode (std::string &&d) : _data(std::move(d)) {} + XMLCDataNode* clone () const override {return new XMLCDataNode(*this);} + void clear () override {_data.clear();} + void append (std::string &&str); + std::ostream& write (std::ostream &os) const override; private: std::string _data; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.cpp index f6fc05dd04a..ed4e3f7e6a9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.cpp @@ -2,7 +2,7 @@ ** XMLString.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -23,17 +23,15 @@ #include <cstdlib> #include <iomanip> #include <sstream> -#include "macros.h" -#include "types.h" -#include "Unicode.h" -#include "XMLString.h" +#include "Unicode.hpp" +#include "XMLString.hpp" using namespace std; int XMLString::DECIMAL_PLACES = 0; -static string translate (UInt32 c) { +static string translate (uint32_t c) { switch (c) { case '<' : return "<"; case '&' : return "&"; @@ -48,8 +46,8 @@ XMLString::XMLString (const string &str, bool plain) { if (plain) assign(str); else { - FORALL(str, string::const_iterator, i) - *this += translate(*i); + for (char c : str) + *this += translate(c); } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.hpp index 1828116e7c3..905d5413952 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** XMLString.h ** +** XMLString.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,8 +18,8 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_XMLSTRING_H -#define DVISVGM_XMLSTRING_H +#ifndef XMLSTRING_HPP +#define XMLSTRING_HPP #include <string> diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ZLibOutputStream.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ZLibOutputStream.hpp new file mode 100644 index 00000000000..3f321625f3e --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ZLibOutputStream.hpp @@ -0,0 +1,120 @@ +/************************************************************************* +** ZLibOutputStream.hpp ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef ZLIBOUTPUTSTREAM_HPP +#define ZLIBOUTPUTSTREAM_HPP + +#include <ostream> +#include <zlib.h> + +class ZLibOutputStream; + +class ZLibOutputBuffer : public std::streambuf +{ + friend class ZLibOutputStream; + public: + ~ZLibOutputBuffer () {close();} + + /** Opens the buffer object for writing. + * @param[in] fname name of gzip file + * @param[in] zipLevel compression level (1-9) + * @return true on success */ + bool open (const char *fname, int zipLevel) { + if (_opened) + return false; + zipLevel = std::max(1, std::min(9, zipLevel)); + std::string modestr = "wb0"; + modestr[2] += zipLevel; + _gzfile = gzopen(fname, modestr.c_str()); + return _opened = (_gzfile != nullptr); + } + + /** Closes the buffer object. */ + bool close () { + if (!_opened) + return false; + sync(); + _opened = false; + return gzclose(_gzfile) == Z_OK; + } + + int overflow (int c) override { + if (!_opened) + return EOF; + if (c != EOF) { + *pptr() = c; + pbump(1); + } + return (flush() == EOF) ? EOF : c; + } + + int sync () override { + return (pptr() && pptr() > pbase() && flush() == EOF) ? -1 : 0; + } + + protected: + ZLibOutputBuffer () : _gzfile(nullptr), _opened(false) { + setp(_buffer, _buffer+SIZE-1); + } + + /** Forces to write the buffer data to the output file. */ + int flush () { + int w = pptr()-pbase(); + if (gzwrite(_gzfile, pbase(), w) != w) + return EOF; + pbump(-w); + return w; + } + + private: + static constexpr int SIZE = 512; + gzFile _gzfile; + char _buffer[SIZE]; + bool _opened; +}; + + +class ZLibOutputStream : public virtual std::ios, public std::ostream +{ + public: + ZLibOutputStream () : std::ostream(&_buf) {init(&_buf);} + ZLibOutputStream (const char *fname, int zipLevel) : ZLibOutputStream() {open(fname, zipLevel);} + ZLibOutputStream (const std::string &fname, int zipLevel) : ZLibOutputStream(fname.c_str(), zipLevel) {} + ~ZLibOutputStream () {close();} + ZLibOutputBuffer* rdbuf() {return &_buf;} + + /** Opens the output stream for writing. + * @param[in] fname name of gzip file + * @param[in] zipLevel compression level (1-9) */ + void open (const char *name, int zipLevel) { + if (!_buf.open(name, zipLevel)) + clear(rdstate()|std::ios::badbit); + } + + void close () { + if (!_buf.close()) + clear(rdstate()|std::ios::badbit); + } + + private: + ZLibOutputBuffer _buf; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp index 03d6463cf33..3502a0f1004 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp @@ -2,7 +2,7 @@ ** dvisvgm.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,44 +18,40 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#include <config.h> #include <clipper.hpp> #include <fstream> #include <iostream> #include <potracelib.h> #include <sstream> #include <xxhash.h> -#include "gzstream.h" -#include "CommandLine.h" -#include "DVIToSVG.h" -#include "DVIToSVGActions.h" -#include "EPSToSVG.h" -#include "FileFinder.h" -#include "FileSystem.h" -#include "Font.h" -#include "FontEngine.h" -#include "Ghostscript.h" -#include "HtmlSpecialHandler.h" -#include "Message.h" -#include "PageSize.h" -#include "PSInterpreter.h" -#include "PsSpecialHandler.h" -#include "SignalHandler.h" -#include "SVGOutput.h" -#include "System.h" +#include <zlib.h> +#include "CommandLine.hpp" +#include "DVIToSVG.hpp" +#include "DVIToSVGActions.hpp" +#include "EPSToSVG.hpp" +#include "FileFinder.hpp" +#include "FileSystem.hpp" +#include "Font.hpp" +#include "FontEngine.hpp" +#include "Ghostscript.hpp" +#include "HtmlSpecialHandler.hpp" +#include "Message.hpp" +#include "PageSize.hpp" +#include "PSInterpreter.hpp" +#include "PsSpecialHandler.hpp" +#include "SignalHandler.hpp" +#include "SVGOutput.hpp" +#include "System.hpp" +#include "version.hpp" + +#ifndef DISABLE_WOFF +#include "ffwrapper.h" +#endif using namespace std; - //////////////////////////////////////////////////////////////////////////////// -static void show_help (const CommandLine &cmd) { - cout << PACKAGE_STRING "\n\n"; - cmd.help(cmd.help_arg()); - cout << "\nCopyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> \n\n"; -} - - static string remove_path (string fname) { fname = FileSystem::adaptPathSeperators(fname); size_t slashpos = fname.rfind('/'); @@ -75,22 +71,22 @@ static string ensure_suffix (string fname, bool eps) { static string get_transformation_string (const CommandLine &args) { ostringstream oss; - if (args.rotate_given()) - oss << 'R' << args.rotate_arg() << ",w/2,h/2"; - if (args.translate_given()) - oss << 'T' << args.translate_arg(); - if (args.scale_given()) - oss << 'S' << args.scale_arg(); - if (args.transform_given()) - oss << args.transform_arg(); + if (args.rotateOpt.given()) + oss << 'R' << args.rotateOpt.value() << ",w/2,h/2"; + if (args.translateOpt.given()) + oss << 'T' << args.translateOpt.value(); + if (args.scaleOpt.given()) + oss << 'S' << args.scaleOpt.value(); + if (args.transformOpt.given()) + oss << args.transformOpt.value(); return oss.str(); } static void set_libgs (CommandLine &args) { #if !defined(DISABLE_GS) && !defined(HAVE_LIBGS) - if (args.libgs_given()) - Ghostscript::LIBGS_NAME = args.libgs_arg(); + if (args.libgsOpt.given()) + Ghostscript::LIBGS_NAME = args.libgsOpt.value(); else if (getenv("LIBGS")) Ghostscript::LIBGS_NAME = getenv("LIBGS"); #endif @@ -98,13 +94,13 @@ static void set_libgs (CommandLine &args) { static bool set_cache_dir (const CommandLine &args) { - if (args.cache_given() && !args.cache_arg().empty()) { - if (args.cache_arg() == "none") + if (args.cacheOpt.given() && !args.cacheOpt.value().empty()) { + if (args.cacheOpt.value() == "none") PhysicalFont::CACHE_PATH = 0; - else if (FileSystem::exists(args.cache_arg())) - PhysicalFont::CACHE_PATH = args.cache_arg().c_str(); + else if (FileSystem::exists(args.cacheOpt.value())) + PhysicalFont::CACHE_PATH = args.cacheOpt.value().c_str(); else - Message::wstream(true) << "cache directory '" << args.cache_arg() << "' does not exist (caching disabled)\n"; + Message::wstream(true) << "cache directory '" << args.cacheOpt.value() << "' does not exist (caching disabled)\n"; } else if (const char *userdir = FileSystem::userdir()) { static string cachepath = userdir + string("/.dvisvgm/cache"); @@ -112,13 +108,13 @@ static bool set_cache_dir (const CommandLine &args) { FileSystem::mkdir(cachepath); PhysicalFont::CACHE_PATH = cachepath.c_str(); } - if (args.cache_given() && args.cache_arg().empty()) { + if (args.cacheOpt.given() && args.cacheOpt.value().empty()) { cout << "cache directory: " << (PhysicalFont::CACHE_PATH ? PhysicalFont::CACHE_PATH : "(none)") << '\n'; try { FontCache::fontinfo(PhysicalFont::CACHE_PATH, cout, true); } catch (StreamReaderException &e) { - Message::wstream(true) << "failed reading cache data"; + Message::wstream(true) << "failed reading cache data\n"; } return false; } @@ -126,6 +122,19 @@ static bool set_cache_dir (const CommandLine &args) { } +static bool set_temp_dir (const CommandLine &args) { + if (args.tmpdirOpt.given()) { + if (!args.tmpdirOpt.value().empty()) + FileSystem::TMPDIR = args.tmpdirOpt.value().c_str(); + else { + cout << "temporary folder: " << FileSystem::tmpdir() << '\n'; + return false; + } + } + return true; +} + + static bool check_bbox (const string &bboxstr) { const char *formats[] = {"none", "min", "preview", "papersize", "dvi", 0}; for (const char **p=formats; *p; ++p) @@ -156,14 +165,17 @@ static bool check_bbox (const string &bboxstr) { static void print_version (bool extended) { ostringstream oss; - oss << PACKAGE_STRING; + oss << "dvisvgm " << PROGRAM_VERSION; if (extended) { if (strlen(TARGET_SYSTEM) > 0) oss << " (" TARGET_SYSTEM ")"; int len = oss.str().length(); oss << "\n" << string(len, '-') << "\n" - "clipper: " << CLIPPER_VERSION "\n" - "freetype: " << FontEngine::version() << "\n"; + "clipper: " << CLIPPER_VERSION "\n"; +#ifndef DISABLE_WOFF + oss << "fontforge: " << ff_version() << '\n'; +#endif + oss << "freetype: " << FontEngine::version() << "\n"; Ghostscript gs; string gsver = gs.revision(true); @@ -172,9 +184,9 @@ static void print_version (bool extended) { const unsigned xxh_ver = XXH_versionNumber(); oss << #ifdef MIKTEX - "MiKTeX: " << FileFinder::version() << "\n" + "MiKTeX: " << FileFinder::instance().version() << "\n" #else - "kpathsea: " << FileFinder::version() << "\n" + "kpathsea: " << FileFinder::instance().version() << "\n" #endif "potrace: " << (strchr(potrace_version(), ' ') ? strchr(potrace_version(), ' ')+1 : "unknown") << "\n" "xxhash: " << xxh_ver/10000 << '.' << (xxh_ver/100)%100 << '.' << xxh_ver%100 << "\n" @@ -184,8 +196,8 @@ static void print_version (bool extended) { } -static void init_fontmap (const CommandLine &args) { - const char *mapseq = args.fontmap_given() ? args.fontmap_arg().c_str() : 0; +static void init_fontmap (const CommandLine &cmdline) { + const char *mapseq = cmdline.fontmapOpt.given() ? cmdline.fontmapOpt.value().c_str() : 0; bool additional = mapseq && strchr("+-=", *mapseq); if (!mapseq || additional) { const char *mapfiles[] = {"ps2pk.map", "dvipdfm.map", "psfonts.map", 0}; @@ -193,119 +205,119 @@ static void init_fontmap (const CommandLine &args) { for (const char **p=mapfiles; *p && !found; p++) found = FontMap::instance().read(*p); if (!found) - Message::wstream(true) << "none of the default map files could be found"; + Message::wstream(true) << "none of the default map files could be found\n"; } if (mapseq) FontMap::instance().read(mapseq); } -int main (int argc, char *argv[]) { - CommandLine args; - args.parse(argc, argv); - if (args.error()) - return 1; - - if (argc == 1 || args.help_given()) { - show_help(args); - return 0; +static void set_variables (const CommandLine &cmdline) { + Message::COLORIZE = cmdline.colorOpt.given(); + if (cmdline.progressOpt.given()) { + DVIToSVG::COMPUTE_PROGRESS = true; + SpecialActions::PROGRESSBAR_DELAY = cmdline.progressOpt.value(); + } + Color::SUPPRESS_COLOR_NAMES = !cmdline.colornamesOpt.given(); + SVGTree::CREATE_CSS = !cmdline.noStylesOpt.given(); + SVGTree::USE_FONTS = !cmdline.noFontsOpt.given(); + if (!SVGTree::setFontFormat(cmdline.fontFormatOpt.value())) { + string msg = "unknown font format '"+cmdline.fontFormatOpt.value()+"' (supported formats: "; + ostringstream oss; + for (const string &format : FontWriter::supportedFormats()) + oss << ", " << format; + msg += oss.str().substr(2) + ')'; + throw CL::CommandLineException(msg); } + SVGTree::CREATE_USE_ELEMENTS = cmdline.noFontsOpt.value() < 1; + SVGTree::ZOOM_FACTOR = cmdline.zoomOpt.value(); + SVGTree::RELATIVE_PATH_CMDS = cmdline.relativeOpt.given(); + SVGTree::MERGE_CHARS = !cmdline.noMergeOpt.given(); + SVGTree::ADD_COMMENTS = cmdline.commentsOpt.given(); + DVIToSVG::TRACE_MODE = cmdline.traceAllOpt.given() ? (cmdline.traceAllOpt.value() ? 'a' : 'm') : 0; + Message::LEVEL = cmdline.verbosityOpt.value(); + PhysicalFont::EXACT_BBOX = cmdline.exactOpt.given(); + PhysicalFont::KEEP_TEMP_FILES = cmdline.keepOpt.given(); + PhysicalFont::METAFONT_MAG = max(1.0, cmdline.magOpt.value()); + XMLString::DECIMAL_PLACES = max(0, min(6, cmdline.precisionOpt.value())); + PsSpecialHandler::COMPUTE_CLIPPATHS_INTERSECTIONS = cmdline.clipjoinOpt.given(); + PsSpecialHandler::SHADING_SEGMENT_OVERLAP = cmdline.gradOverlapOpt.given(); + PsSpecialHandler::SHADING_SEGMENT_SIZE = max(1, cmdline.gradSegmentsOpt.value()); + PsSpecialHandler::SHADING_SIMPLIFY_DELTA = cmdline.gradSimplifyOpt.value(); +} - Message::COLORIZE = args.color_given(); +int main (int argc, char *argv[]) { + CommandLine cmdline; try { - FileFinder::init(argv[0], "dvisvgm", !args.no_mktexmf_given()); + cmdline.parse(argc, argv); + if (argc == 1 || cmdline.helpOpt.given()) { + cmdline.help(cout, cmdline.helpOpt.value()); + return 0; + } + FileFinder::init(argv[0], "dvisvgm", !cmdline.noMktexmfOpt.given()); + set_libgs(cmdline); + if (cmdline.versionOpt.given()) { + print_version(cmdline.versionOpt.value()); + return 0; + } + if (cmdline.listSpecialsOpt.given()) { + DVIToSVG::setProcessSpecials(); + SpecialManager::instance().writeHandlerInfo(cout); + return 0; + } + if (!set_cache_dir(cmdline) || !set_temp_dir(cmdline)) + return 0; + if (cmdline.stdoutOpt.given() && cmdline.zipOpt.given()) { + Message::estream(true) << "writing SVGZ files to stdout is not supported\n"; + return 1; + } + if (!check_bbox(cmdline.bboxOpt.value())) + return 1; + if (!HtmlSpecialHandler::setLinkMarker(cmdline.linkmarkOpt.value())) + Message::wstream(true) << "invalid argument '"+cmdline.linkmarkOpt.value()+"' supplied for option --linkmark\n"; + if (argc > 1 && cmdline.filenames().size() < 1) { + Message::estream(true) << "no input file given\n"; + return 1; + } } catch (MessageException &e) { - Message::estream(true) << e.what() << '\n'; - return 0; - } - - set_libgs(args); - if (args.version_given()) { - print_version(args.version_arg()); - return 0; - } - if (args.list_specials_given()) { - DVIToSVG::setProcessSpecials(); - SpecialManager::instance().writeHandlerInfo(cout); - return 0; - } - - if (!set_cache_dir(args)) - return 0; - - if (argc > 1 && args.numFiles() < 1) { - Message::estream(true) << "no input file given\n"; - return 1; - } - - if (args.stdout_given() && args.zip_given()) { - Message::estream(true) << "writing SVGZ files to stdout is not supported\n"; + Message::estream() << e.what() << '\n'; return 1; } - if (!check_bbox(args.bbox_arg())) - return 1; - - if (args.progress_given()) { - DVIToSVG::COMPUTE_PROGRESS = args.progress_given(); - SpecialActions::PROGRESSBAR_DELAY = args.progress_arg(); - } - Color::SUPPRESS_COLOR_NAMES = !args.colornames_given(); - SVGTree::CREATE_CSS = !args.no_styles_given(); - SVGTree::USE_FONTS = !args.no_fonts_given(); - SVGTree::CREATE_USE_ELEMENTS = args.no_fonts_arg() < 1; - SVGTree::ZOOM_FACTOR = args.zoom_arg(); - SVGTree::RELATIVE_PATH_CMDS = args.relative_given(); - SVGTree::MERGE_CHARS = !args.no_merge_given(); - SVGTree::ADD_COMMENTS = args.comments_given(); - DVIToSVG::TRACE_MODE = args.trace_all_given() ? (args.trace_all_arg() ? 'a' : 'm') : 0; - Message::LEVEL = args.verbosity_arg(); - PhysicalFont::EXACT_BBOX = args.exact_given(); - PhysicalFont::KEEP_TEMP_FILES = args.keep_given(); - PhysicalFont::METAFONT_MAG = max(1.0, args.mag_arg()); - XMLString::DECIMAL_PLACES = max(0, min(6, args.precision_arg())); - if (!HtmlSpecialHandler::setLinkMarker(args.linkmark_arg())) - Message::wstream(true) << "invalid argument '"+args.linkmark_arg()+"' supplied for option --linkmark\n"; - double start_time = System::time(); - bool eps_given=false; -#ifndef DISABLE_GS - eps_given = args.eps_given(); - PsSpecialHandler::COMPUTE_CLIPPATHS_INTERSECTIONS = args.clipjoin_given(); - PsSpecialHandler::SHADING_SEGMENT_OVERLAP = args.grad_overlap_given(); - PsSpecialHandler::SHADING_SEGMENT_SIZE = max(1, args.grad_segments_arg()); - PsSpecialHandler::SHADING_SIMPLIFY_DELTA = args.grad_simplify_arg(); -#endif - string inputfile = ensure_suffix(args.file(0), eps_given); + bool eps_given = cmdline.epsOpt.given(); + string inputfile = ensure_suffix(cmdline.filenames()[0], eps_given); ifstream ifs(inputfile.c_str(), ios::binary|ios::in); if (!ifs) { Message::estream(true) << "can't open file '" << inputfile << "' for reading\n"; return 0; } try { - SVGOutput out(args.stdout_given() ? 0 : inputfile.c_str(), args.output_arg(), args.zip_given() ? args.zip_arg() : 0); + double start_time = System::time(); + set_variables(cmdline); + SVGOutput out(cmdline.stdoutOpt.given() ? nullptr : inputfile.c_str(), + cmdline.outputOpt.value(), + cmdline.zipOpt.given() ? cmdline.zipOpt.value() : 0); SignalHandler::instance().start(); -#ifndef DISABLE_GS - if (args.eps_given()) { + if (cmdline.epsOpt.given()) { EPSToSVG eps2svg(inputfile, out); eps2svg.convert(); Message::mstream().indent(0); - Message::mstream(false, Message::MC_PAGE_NUMBER) - << "file converted in " << (System::time()-start_time) << " seconds\n"; + Message::mstream(false, Message::MC_PAGE_NUMBER) << "file converted in " << (System::time()-start_time) << " seconds\n"; } - else -#endif - { - init_fontmap(args); + else { + init_fontmap(cmdline); DVIToSVG dvi2svg(ifs, out); - const char *ignore_specials = args.no_specials_given() ? (args.no_specials_arg().empty() ? "*" : args.no_specials_arg().c_str()) : 0; + const char *ignore_specials=nullptr; + if (cmdline.noSpecialsOpt.given()) + ignore_specials = cmdline.noSpecialsOpt.value().empty() ? "*" : cmdline.noSpecialsOpt.value().c_str(); dvi2svg.setProcessSpecials(ignore_specials, true); - dvi2svg.setPageTransformation(get_transformation_string(args)); - dvi2svg.setPageSize(args.bbox_arg()); + dvi2svg.setPageTransformation(get_transformation_string(cmdline)); + dvi2svg.setPageSize(cmdline.bboxOpt.value()); pair<int,int> pageinfo; - dvi2svg.convert(args.page_arg(), &pageinfo); + dvi2svg.convert(cmdline.pageOpt.value(), &pageinfo); Message::mstream().indent(0); Message::mstream(false, Message::MC_PAGE_NUMBER) << "\n" << pageinfo.first << " of " << pageinfo.second << " page"; if (pageinfo.second > 1) @@ -326,7 +338,5 @@ int main (int argc, char *argv[]) { catch (MessageException &e) { Message::estream(true) << e.what() << '\n'; } - FileFinder::finish(); return 0; } - diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.c b/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.c new file mode 100644 index 00000000000..e74d4d6e8ec --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.c @@ -0,0 +1,101 @@ +/************************************************************************* +** ffwrapper.c ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#include <fontforge.h> +#include "ffwrapper.h" + +#ifdef _NDEBUG +static void no_post_error (const char *title, const char *error, ...) {} +static void no_warning (const char *format, ...) {} +#endif + + +/** Initializes the FontForge library. */ +void ff_init () { + InitSimpleStuff(); +#ifdef _NDEBUG + ui_interface.post_error = &no_post_error; + ui_interface.logwarning = &no_warning; +#endif +} + + +int ff_version () { + return FONTFORGE_VERSIONDATE_RAW; +} + + +/** Runs the autohinter for all glyphs in a given font. + * @param[in,out] sf the font to be autohinted + * @param[in] order2 if != 0, target font requires quadratic rather than cubic splines */ +static void ff_autohint (SplineFont *sf, int order2) { + BlueData bd; + GlobalInstrCt gic; + if (order2) + SFConvertToOrder2(sf); + QuickBlues(sf, ly_fore, &bd); + if (order2) + InitGlobalInstrCt(&gic, sf, ly_fore, &bd); + for (int i=0; i < sf->glyphcnt; i++) { + SplineChar *sc = sf->glyphs[i]; + if (sc != NULL) { + SplineChar *sc = sf->glyphs[i]; + SplineCharAutoHint(sc, ly_fore, &bd); // generate hints + if (order2) + NowakowskiSCAutoInstr(&gic, sc); // generate TTF instructions + } + } + if (order2) + FreeGlobalInstrCt(&gic); +} + + +/** Creates a TrueType font from a FontForge SFD file. + * @param[in] sfdname name of SFD file + * @param[in] ttfname name of TrueType file + * @param[in] autohint run the autohinter if != 0 */ +int ff_sfd_to_ttf (const char *sfdname, const char *ttfname, int autohint) { + int ret=0; + SplineFont *sf = SFDRead((char*)sfdname); + if (sf) { + if (autohint) + ff_autohint(sf, true); + ret = WriteTTFFont((char*)ttfname, sf, ff_ttf, 0, 0, 0, sf->map, ly_fore); + SplineFontFree(sf); + } + return ret; +} + + +/** Creates a WOFF font from a FontForge SFD file. + * @param[in] sfdname name of SFD file + * @param[in] woffname name of WOFF file + * @param[in] autohint run the autohinter if != 0 */ +int ff_sfd_to_woff (const char *sfdname, const char *woffname, int autohint) { + int ret=0; + SplineFont *sf = SFDRead((char*)sfdname); + if (sf) { + if (autohint) + ff_autohint(sf, false); + ret = WriteWOFFFont((char*)woffname, sf, ff_woff, 0, 0, 0, sf->map, ly_fore); + SplineFontFree(sf); + } + return ret; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.h new file mode 100644 index 00000000000..763d122e56a --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.h @@ -0,0 +1,38 @@ +/************************************************************************* +** ffwrapper.h ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef FFWRAPPER_H +#define FFWRAPPER_H + +#ifdef __cplusplus +extern "C" { +#endif + +void ff_init (); +int ff_version (); +int ff_sfd_to_ttf (const char *sfdname, const char *ttfname, int autohint); +int ff_sfd_to_woff (const char *sfdname, const char *woffname, int autohint); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/gzstream.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/gzstream.cpp deleted file mode 100644 index 2893c299891..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/gzstream.cpp +++ /dev/null @@ -1,172 +0,0 @@ -// ============================================================================ -// gzstream, C++ iostream classes wrapping the zlib compression library. -// Copyright (C) 2001 Deepak Bandyopadhyay, Lutz Kettner -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// ============================================================================ -// -// File : gzstream.C -// Revision : $Revision: 1.3 $ -// Revision_date : $Date: 2006/01/05 16:22:35 $ -// Author(s) : Deepak Bandyopadhyay, Lutz Kettner -// -// Standard streambuf implementation following Nicolai Josuttis, "The -// Standard C++ Library". -// ============================================================================ - -#include "gzstream.h" -#include <iostream> -#include <string.h> // for memcpy - -#ifdef GZSTREAM_NAMESPACE -namespace GZSTREAM_NAMESPACE { -#endif - -const int gzstreambuf::bufferSize = 47+256; // size of data buff - -// ---------------------------------------------------------------------------- -// Internal classes to implement gzstream. See header file for user classes. -// ---------------------------------------------------------------------------- - -// -------------------------------------- -// class gzstreambuf: -// -------------------------------------- - -gzstreambuf* gzstreambuf::open(const char* name, int compression_level, int open_mode) { - if ( is_open()) - return (gzstreambuf*)0; - mode = open_mode; - // no append nor read/write mode - if ((mode & std::ios::ate) || (mode & std::ios::app) - || ((mode & std::ios::in) && (mode & std::ios::out))) - return (gzstreambuf*)0; - if (compression_level < 1) - compression_level = 1; - else if (compression_level > 9) - compression_level = 9; - char fmode[10]; - char* fmodeptr = fmode; - if ( mode & std::ios::in) - *fmodeptr++ = 'r'; - else if ( mode & std::ios::out) - *fmodeptr++ = 'w'; - *fmodeptr++ = 'b'; - *fmodeptr++ = '0'+compression_level; - *fmodeptr = '\0'; - file = gzopen( name, fmode); - if (file == 0) - return (gzstreambuf*)0; - opened = 1; - return this; -} - -gzstreambuf * gzstreambuf::close() { - if ( is_open()) { - sync(); - opened = 0; - if ( gzclose( file) == Z_OK) - return this; - } - return (gzstreambuf*)0; -} - -int gzstreambuf::underflow() { // used for input buffer only - if ( gptr() && ( gptr() < egptr())) - return * reinterpret_cast<unsigned char *>( gptr()); - - if ( ! (mode & std::ios::in) || ! opened) - return EOF; - // Josuttis' implementation of inbuf - int n_putback = gptr() - eback(); - if ( n_putback > 4) - n_putback = 4; - memcpy( buffer + (4 - n_putback), gptr() - n_putback, n_putback); - - int num = gzread( file, buffer+4, bufferSize-4); - if (num <= 0) // ERROR or EOF - return EOF; - - // reset buffer pointers - setg( buffer + (4 - n_putback), // beginning of putback area - buffer + 4, // read position - buffer + 4 + num); // end of buffer - - // return next character - return * reinterpret_cast<unsigned char *>( gptr()); -} - -int gzstreambuf::flush_buffer() { - // Separate the writing of the buffer from overflow() and - // sync() operation. - int w = pptr() - pbase(); - if ( gzwrite( file, pbase(), w) != w) - return EOF; - pbump( -w); - return w; -} - -int gzstreambuf::overflow( int c) { // used for output buffer only - if ( ! ( mode & std::ios::out) || ! opened) - return EOF; - if (c != EOF) { - *pptr() = c; - pbump(1); - } - if ( flush_buffer() == EOF) - return EOF; - return c; -} - -int gzstreambuf::sync() { - // Changed to use flush_buffer() instead of overflow( EOF) - // which caused improper behavior with std::endl and flush(), - // bug reported by Vincent Ricard. - if ( pptr() && pptr() > pbase()) { - if ( flush_buffer() == EOF) - return -1; - } - return 0; -} - -// -------------------------------------- -// class gzstreambase: -// -------------------------------------- - -gzstreambase::gzstreambase( const char* name, int compression_level, int mode) { - init( &buf); - open( name, compression_level, mode); -} - -gzstreambase::~gzstreambase() { - buf.close(); -} - -void gzstreambase::open( const char* name, int compression_level, int open_mode) { - if ( ! buf.open( name, compression_level, open_mode)) - clear( rdstate() | std::ios::badbit); -} - -void gzstreambase::close() { - if ( buf.is_open()) - if ( ! buf.close()) - clear( rdstate() | std::ios::badbit); -} - -#ifdef GZSTREAM_NAMESPACE -} // namespace GZSTREAM_NAMESPACE -#endif - -// ============================================================================ -// EOF // diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/gzstream.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/gzstream.h deleted file mode 100644 index 60f38c4fac7..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/gzstream.h +++ /dev/null @@ -1,121 +0,0 @@ -// ============================================================================ -// gzstream, C++ iostream classes wrapping the zlib compression library. -// Copyright (C) 2001 Deepak Bandyopadhyay, Lutz Kettner -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// ============================================================================ -// -// File : gzstream.h -// Revision : $Revision: 1.3 $ -// Revision_date : $Date: 2006/01/05 16:22:35 $ -// Author(s) : Deepak Bandyopadhyay, Lutz Kettner -// -// Standard streambuf implementation following Nicolai Josuttis, "The -// Standard C++ Library". -// ============================================================================ - -#ifndef GZSTREAM_H -#define GZSTREAM_H 1 - -// standard C++ with new header file names and std:: namespace -#include <iostream> -#include <fstream> -#include <zlib.h> - -#ifdef GZSTREAM_NAMESPACE -namespace GZSTREAM_NAMESPACE { -#endif - -// ---------------------------------------------------------------------------- -// Internal classes to implement gzstream. See below for user classes. -// ---------------------------------------------------------------------------- - -class gzstreambuf : public std::streambuf { -private: - static const int bufferSize; // size of data buff - // totals 512 bytes under g++ for igzstream at the end. - - gzFile file; // file handle for compressed file - char buffer[47+256]; // data buffer - char opened; // open/close state of stream - int mode; // I/O mode - - int flush_buffer(); -public: - gzstreambuf() : opened(0) { - setp( buffer, buffer + (bufferSize-1)); - setg( buffer + 4, // beginning of putback area - buffer + 4, // read position - buffer + 4); // end position - // ASSERT: both input & output capabilities will not be used together - } - int is_open() { return opened; } - gzstreambuf* open(const char* name, int compression_level, int open_mode); - gzstreambuf* close(); - ~gzstreambuf() { close(); } - - virtual int overflow( int c = EOF); - virtual int underflow(); - virtual int sync(); -}; - -class gzstreambase : virtual public std::ios { -protected: - gzstreambuf buf; -public: - gzstreambase() { init(&buf); } - gzstreambase( const char* name, int compression_level, int open_mode); - ~gzstreambase(); - void open( const char* name, int compression_level, int open_mode); - void close(); - gzstreambuf* rdbuf() { return &buf; } -}; - -// ---------------------------------------------------------------------------- -// User classes. Use igzstream and ogzstream analogously to ifstream and -// ofstream respectively. They read and write files based on the gz* -// function interface of the zlib. Files are compatible with gzip compression. -// ---------------------------------------------------------------------------- - -class igzstream : public gzstreambase, public std::istream { -public: - igzstream() : std::istream( &buf) {} - igzstream( const char* name, int compression_level, int open_mode = std::ios::in) - : gzstreambase(name, compression_level, open_mode), std::istream( &buf) {} - gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); } - void open( const char* name, int compression_level, int open_mode = std::ios::in) { - gzstreambase::open( name, compression_level, open_mode); - } -}; - -class ogzstream : public gzstreambase, public std::ostream { -public: - ogzstream() : std::ostream( &buf) {} - ogzstream( const char* name, int compression_level, int mode = std::ios::out) - : gzstreambase(name, compression_level, mode), std::ostream( &buf) {} - gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); } - void open( const char* name, int compression_level, int open_mode = std::ios::out) { - gzstreambase::open(name, compression_level, open_mode); - } -}; - -#ifdef GZSTREAM_NAMESPACE -} // namespace GZSTREAM_NAMESPACE -#endif - -#endif // GZSTREAM_H -// ============================================================================ -// EOF // - diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/macros.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/macros.hpp index 787f2ad10ca..1966d31e17b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/macros.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/macros.hpp @@ -1,8 +1,8 @@ /************************************************************************* -** macros.h ** +** macros.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,11 +18,8 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_MACROS_H -#define DVISVGM_MACROS_H - -#define FORALL(container, itertype, itervar) \ - for (itertype itervar=(container).begin(); itervar != (container).end(); ++itervar) +#ifndef MACROS_HPP +#define MACROS_HPP #define IMPLEMENT_ARITHMETIC_OPERATOR(class, op) \ inline class operator op (class a, const class &b) { \ diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/options.dtd b/Build/source/texk/dvisvgm/dvisvgm-src/src/options.dtd index af340a2a9eb..ff016a33990 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/options.dtd +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/options.dtd @@ -3,7 +3,7 @@ ** options.dtd ** ** ** ** This file is part of dvisvgm - a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -23,13 +23,11 @@ <!ATTLIST cmdline class NMTOKEN #REQUIRED> -<!ELEMENT program (name,usage+,description)> - +<!ELEMENT program (usage+,description,copyright)> <!ELEMENT options (section)+> - <!ELEMENT name (#PCDATA)> - <!ELEMENT usage (#PCDATA)> +<!ELEMENT copyright (#PCDATA)> <!ELEMENT section (option)+> <!ATTLIST section diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml b/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml index ecc4b08d8c5..cf1e0346e21 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml @@ -3,7 +3,7 @@ ** options.xml ** ** ** ** This file is part of dvisvgm - a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -22,16 +22,16 @@ <cmdline class="CommandLine"> <program> - <name>dvisvgm</name> <usage>[options] dvifile</usage> <usage>-E [options] epsfile</usage> <description>This program converts DVI files, as created by TeX/LaTeX, to\nthe XML-based scalable vector graphics format SVG.</description> + <copyright>Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de></copyright> </program> <options> <section title="Input options"> <option long="page" short="p"> <arg type="string" name="ranges" default="1"/> - <description>choose pages to convert</description> + <description>choose page(s) to convert</description> </option> <option long="fontmap" short="m"> <arg type="string" name="filenames"/> @@ -55,8 +55,12 @@ <option long="comments"> <description>add comments with additional information</description> </option> + <option long="font-format" short="f" if="!defined(DISABLE_WOFF)"> + <arg type="string" name="format" default="svg"/> + <description>select file format of embedded fonts</description> + </option> <option long="grad-overlap" if="!defined(DISABLE_GS)"> - <description>create operlapping color gradient segments</description> + <description>create overlapping color gradient segments</description> </option> <option long="grad-segments" if="!defined(DISABLE_GS)"> <arg type="int" name="number" default="20"/> @@ -84,6 +88,10 @@ <option long="stdout" short="s"> <description>write SVG output to stdout</description> </option> + <option long="tmpdir"> + <arg type="string" name="path" optional="yes"/> + <description>set/print the directory for temporary files</description> + </option> <option long="no-fonts" short="n"> <arg type="int" name="variant" default="0" optional="yes"/> <description>draw glyphs by using path elements</description> @@ -92,7 +100,7 @@ <description>don't merge adjacent text elements</description> </option> <option long="no-styles"> - <description>don't use styles to reference fonts</description> + <description>don't use CSS styles to reference fonts</description> </option> <option long="zip" short="z"> <arg type="int" name="level" default="9" optional="yes"/> @@ -148,7 +156,7 @@ <description>don't process [selected] specials</description> </option> <option long="trace-all" short="a"> - <arg name="retrace" type="bool" optional="yes" default="no"/> + <arg name="retrace" type="bool" optional="yes" default="false"/> <description>trace all glyphs of bitmap fonts</description> </option> </section> @@ -165,17 +173,16 @@ </option> <option long="progress" short="P"> <arg name="delay" type="double" optional="yes" default="0.5"/> - <description>enable progess indicator</description> + <description>enable progress indicator</description> </option> <option long="verbosity" short="v"> <arg type="unsigned" name="level" default="7"/> <description>set verbosity level (0-7)</description> </option> <option long="version" short="V"> - <arg type="bool" name="extended" optional="yes" default="no"/> + <arg type="bool" name="extended" optional="yes" default="false"/> <description>print version and exit</description> </option> </section> </options> </cmdline> - diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp index dee64606f8f..eafc838749e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp @@ -2,7 +2,7 @@ ** psdefs.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -18,7 +18,7 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#include "PSInterpreter.h" +#include "PSInterpreter.hpp" const char *PSInterpreter::PSDEFS = "<</Install{matrix setmatrix}/HWResolution[72 72]/PageSize[10000 10000]/Imaging" diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/types.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/types.h deleted file mode 100644 index 049fc440b79..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/types.h +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************* -** types.h ** -** ** -** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** published by the Free Software Foundation; either version 3 of ** -** the License, or (at your option) any later version. ** -** ** -** This program is distributed in the hope that it will be useful, but ** -** WITHOUT ANY WARRANTY; without even the implied warranty of ** -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** -** GNU General Public License for more details. ** -** ** -** You should have received a copy of the GNU General Public License ** -** along with this program; if not, see <http://www.gnu.org/licenses/>. ** -*************************************************************************/ - -#ifndef DVISVGM_TYPES_H -#define DVISVGM_TYPES_H - -namespace internal { - template<unsigned BYTES> - class ERROR_inttype_not_available - { - ERROR_inttype_not_available(); - }; - - template<bool FIRST, typename A, typename B> - struct select - { - typedef A T; - }; - - template<typename A, typename B> - struct select<false, A, B> - { - typedef B T; - }; -} - - -// Retrieves a signed integer type with sizeof(T) == BYTES -template<unsigned BYTES, bool SIGNED> -struct int_t -{ - typedef typename internal::select<sizeof(signed char) == BYTES, signed char, - typename internal::select<sizeof(signed short) == BYTES, signed short, - typename internal::select<sizeof(signed int) == BYTES, signed int, - typename internal::select<sizeof(signed long) == BYTES, signed long, - typename internal::select<sizeof(signed long long) == BYTES, signed long long, - internal::ERROR_inttype_not_available<BYTES> >::T>::T>::T>::T>::T T; -}; - - -// Retrieves an unsigned integer type with sizeof(T) == BYTES -template<unsigned BYTES> -struct int_t<BYTES, false> -{ - typedef typename internal::select<sizeof(unsigned char) == BYTES, unsigned char, - typename internal::select<sizeof(unsigned short) == BYTES, unsigned short, - typename internal::select<sizeof(unsigned int) == BYTES, unsigned int, - typename internal::select<sizeof(unsigned long) == BYTES, unsigned long, - typename internal::select<sizeof(unsigned long long) == BYTES, unsigned long long, - internal::ERROR_inttype_not_available<BYTES> >::T>::T>::T>::T>::T T; -}; - - -// Machine independent definition of sized integer types -typedef int_t<1, true>::T Int8; -typedef int_t<2, true>::T Int16; -typedef int_t<4, true>::T Int32; -typedef int_t<8, true>::T Int64; -typedef int_t<1, false>::T UInt8; -typedef int_t<2, false>::T UInt16; -typedef int_t<4, false>::T UInt32; -typedef int_t<8, false>::T UInt64; - -typedef Int32 FixWord; -typedef UInt32 ScaledInt; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.cpp new file mode 100644 index 00000000000..c6b9ea63fe9 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.cpp @@ -0,0 +1,74 @@ +/************************************************************************* +** utility.cpp ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#include <algorithm> +#include <cctype> +#include <functional> +#include "utility.hpp" + +using namespace std; + + +/** Returns a given string with leading and trailing whitespace removed. + * @param[in] str the string to process + * @param[in] ws characters treated as whitespace + * @return the trimmed string */ +string util::trim (const std::string &str, const char *ws) { + size_t first = str.find_first_not_of(ws); + if (first == string::npos) + return ""; + size_t last = str.find_last_not_of(ws); + return str.substr(first, last-first+1); +} + + +/** Removes leading and trailing whitespace from a given string, and replaces + * all other whitespace sequences by single spaces. + * @param[in] str the string to process + * @param[in] ws characters treated as whitespace + * @return the normalized string */ +string util::normalize_space (string str, const char *ws) { + str = trim(str); + size_t first = str.find_first_of(ws); + while (first != string::npos) { + size_t last = str.find_first_not_of(ws, first); + str.replace(first, last-first, " "); + first = str.find_first_of(ws, first+1); + } + return str; +} + + +string& util::tolower (string &str) { + transform(str.begin(), str.end(), str.begin(), ::tolower); + return str; +} + + +/** Returns the integer part of log10 of a given integer \f$n>0\f$. + * If \f$n<0\f$, the result is 0. */ +int util::ilog10 (int n) { + int result = 0; + while (n >= 10) { + result++; + n /= 10; + } + return result; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.hpp new file mode 100644 index 00000000000..63d12087e71 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.hpp @@ -0,0 +1,66 @@ +/************************************************************************* +** utility.hpp ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef UTILITY_HPP +#define UTILITY_HPP + +#include <string> + +namespace util { + +std::string trim (const std::string &str, const char *ws=" \t\n\r\f"); +std::string normalize_space (std::string str, const char *ws=" \t\n\r\f"); +std::string& tolower (std::string &str); +int ilog10 (int n); + + +/** Encodes the bytes in the half-open range [first,last) to Base64 and writes + * the result to the range starting at 'dest'. + * @param[in] first initial position of the range to be encoded + * @param[in] last final position of the range to be encoded + * @param[in] dest first position of the destination range */ +template <typename InputIterator, typename OutputIterator> +void base64_copy (InputIterator first, InputIterator last, OutputIterator dest) { + static const char *base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + while (first != last) { + int padding = 0; + unsigned char c0 = *first++, c1=0, c2=0; + if (first == last) + padding = 2; + else { + c1 = *first++; + if (first == last) + padding = 1; + else + c2 = *first++; + } + uint32_t n = (c0 << 16) | (c1 << 8) | c2; + for (int i=0; i <= 3-padding; i++) { + *dest++ = base64_chars[(n >> 18) & 0x3f]; + n <<= 6; + } + while (padding--) + *dest++ = '='; + } +} + +} // namespace util + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp new file mode 100644 index 00000000000..a25832a7f9e --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp @@ -0,0 +1,28 @@ +/************************************************************************* +** version.hpp ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef VERSION_HPP +#define VERSION_HPP + +constexpr const char *PROGRAM_NAME = "dvisvgm"; +constexpr const char *PROGRAM_VERSION = "2.1"; + +#endif + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp.in b/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp.in new file mode 100644 index 00000000000..40477d7360f --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp.in @@ -0,0 +1,28 @@ +/************************************************************************* +** version.hpp ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef VERSION_HPP +#define VERSION_HPP + +constexpr const char *PROGRAM_NAME = "dvisvgm"; +constexpr const char *PROGRAM_VERSION = "@VERSION@"; + +#endif + |