30#include <rtl/math.hxx>
31#include <rtl/strbuf.hxx>
32#include <rtl/string.hxx>
38typedef sal_uInt16
U16;
77constexpr OStringLiteral
tok_at =
"at";
78constexpr OStringLiteral
tok_A =
"A";
79constexpr OStringLiteral
tok_B =
"B";
80constexpr OStringLiteral
tok_C =
"C";
81constexpr OStringLiteral
tok_D =
"D";
82constexpr OStringLiteral
tok_E =
"E";
83constexpr OStringLiteral
tok_F =
"F";
84constexpr OStringLiteral
tok_G =
"G";
85constexpr OStringLiteral
tok_H =
"H";
86constexpr OStringLiteral
tok_I =
"I";
87constexpr OStringLiteral
tok_J =
"J";
88constexpr OStringLiteral
tok_K =
"K";
89constexpr OStringLiteral
tok_L =
"L";
90constexpr OStringLiteral
tok_M =
"M";
91constexpr OStringLiteral
tok_N =
"N";
92constexpr OStringLiteral
tok_O =
"O";
93constexpr OStringLiteral
tok_P =
"P";
94constexpr OStringLiteral
tok_Q =
"Q";
95constexpr OStringLiteral
tok_R =
"R";
96constexpr OStringLiteral
tok_S =
"S";
97constexpr OStringLiteral
tok_T =
"T";
98constexpr OStringLiteral
tok_U =
"U";
99constexpr OStringLiteral
tok_V =
"V";
100constexpr OStringLiteral
tok_W =
"W";
101constexpr OStringLiteral
tok_X =
"X";
102constexpr OStringLiteral
tok_Y =
"Y";
103constexpr OStringLiteral
tok_Z =
"Z";
110constexpr OStringLiteral
tok_a =
"a";
111constexpr OStringLiteral
tok_b =
"b";
112constexpr OStringLiteral
tok_c =
"c";
113constexpr OStringLiteral
tok_d =
"d";
114constexpr OStringLiteral
tok_e =
"e";
115constexpr OStringLiteral
tok_f =
"f";
116constexpr OStringLiteral
tok_g =
"g";
117constexpr OStringLiteral
tok_h =
"h";
118constexpr OStringLiteral
tok_i =
"i";
119constexpr OStringLiteral
tok_j =
"j";
120constexpr OStringLiteral
tok_k =
"k";
121constexpr OStringLiteral
tok_l =
"l";
122constexpr OStringLiteral
tok_m =
"m";
123constexpr OStringLiteral
tok_n =
"n";
124constexpr OStringLiteral
tok_o =
"o";
125constexpr OStringLiteral
tok_p =
"p";
126constexpr OStringLiteral
tok_q =
"q";
127constexpr OStringLiteral
tok_r =
"r";
128constexpr OStringLiteral
tok_s =
"s";
129constexpr OStringLiteral
tok_t =
"t";
130constexpr OStringLiteral
tok_u =
"u";
131constexpr OStringLiteral
tok_v =
"v";
132constexpr OStringLiteral
tok_w =
"w";
133constexpr OStringLiteral
tok_x =
"x";
134constexpr OStringLiteral
tok_y =
"y";
135constexpr OStringLiteral
tok_z =
"z";
539 "sVersion",
"sNotice",
"sFullName",
"sFamilyName",
540 "sWeight",
"aFontBBox",
"dBlueValues",
"dOtherBlues",
541 "dFamilyBlues",
"dFamilyOtherBlues",
"nStdHW",
"nStdVW",
542 "xESC",
"nUniqueID",
"aXUID",
"nCharset",
543 "nEncoding",
"nCharStrings",
"PPrivate",
"nSubrs",
544 "nDefaultWidthX",
"nNominalWidthX",
nullptr,
nullptr,
545 nullptr,
nullptr,
nullptr,
nullptr,
546 "shortint",
"longint",
"BCD",
nullptr
551 "sCopyright",
"bIsFixedPitch",
"nItalicAngle",
"nUnderlinePosition",
552 "nUnderlineThickness",
"nPaintType",
"tCharstringType",
"aFontMatrix",
553 "nStrokeWidth",
"nBlueScale",
"nBlueShift",
"nBlueFuzz",
554 "dStemSnapH",
"dStemSnapV",
"bForceBold",
nullptr,
555 nullptr,
"nLanguageGroup",
"nExpansionFactor",
"nInitialRandomSeed",
556 "nSyntheticBase",
"sPostScript",
"sBaseFontName",
"dBaseFontBlend",
557 nullptr,
nullptr,
nullptr,
nullptr,
558 nullptr,
nullptr,
"rROS",
"nCIDFontVersion",
559 "nCIDFontRevision",
"nCIDFontType",
"nCIDCount",
"nUIDBase",
560 "nFDArray",
"nFDSelect",
"sFontName"
564 ".notdef",
".notdef",
".notdef",
".notdef",
".notdef",
565 ".notdef",
".notdef",
".notdef",
".notdef",
".notdef",
566 ".notdef",
".notdef",
".notdef",
".notdef",
".notdef",
567 ".notdef",
".notdef",
".notdef",
".notdef",
".notdef",
568 ".notdef",
".notdef",
".notdef",
".notdef",
".notdef",
569 ".notdef",
".notdef",
".notdef",
".notdef",
".notdef",
570 ".notdef",
".notdef",
"space",
"exclam",
"quotedbl",
571 "numbersign",
"dollar",
"percent",
"ampersand",
572 "quoteright",
"parenleft",
"parenright",
"asterisk",
"plus",
573 "comma",
"hyphen",
"period",
"slash",
"zero",
"one",
"two",
574 "three",
"four",
"five",
"six",
"seven",
"eight",
"nine",
575 "colon",
"semicolon",
"less",
"equal",
"greater",
576 "question",
"at",
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
577 "I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
578 "U",
"V",
"W",
"X",
"Y",
"Z",
"bracketleft",
"backslash",
579 "bracketright",
"asciicircum",
"underscore",
"quoteleft",
580 "a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
581 "m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
582 "y",
"z",
"braceleft",
"bar",
"braceright",
"asciitilde",
583 ".notdef",
".notdef",
".notdef",
".notdef",
".notdef",
584 ".notdef",
".notdef",
".notdef",
".notdef",
".notdef",
585 ".notdef",
".notdef",
".notdef",
".notdef",
".notdef",
586 ".notdef",
".notdef",
".notdef",
".notdef",
".notdef",
587 ".notdef",
".notdef",
".notdef",
".notdef",
".notdef",
588 ".notdef",
".notdef",
".notdef",
".notdef",
".notdef",
589 ".notdef",
".notdef",
".notdef",
".notdef",
"exclamdown",
590 "cent",
"sterling",
"fraction",
"yen",
"florin",
"section",
591 "currency",
"quotesingle",
"quotedblleft",
"guillemotleft",
592 "guilsinglleft",
"guilsinglright",
"fi",
"fl",
".notdef",
593 "endash",
"dagger",
"daggerdbl",
"periodcentered",
594 ".notdef",
"paragraph",
"bullet",
"quotesinglbase",
595 "quotedblbase",
"quotedblright",
"guillemotright",
596 "ellipsis",
"perthousand",
".notdef",
"questiondown",
597 ".notdef",
"grave",
"acute",
"circumflex",
"tilde",
598 "macron",
"breve",
"dotaccent",
"dieresis",
".notdef",
599 "ring",
"cedilla",
".notdef",
"hungarumlaut",
"ogonek",
600 "caron",
"emdash",
".notdef",
".notdef",
".notdef",
601 ".notdef",
".notdef",
".notdef",
".notdef",
".notdef",
602 ".notdef",
".notdef",
".notdef",
".notdef",
".notdef",
603 ".notdef",
".notdef",
".notdef",
"AE",
".notdef",
604 "ordfeminine",
".notdef",
".notdef",
".notdef",
".notdef",
605 "Lslash",
"Oslash",
"OE",
"ordmasculine",
".notdef",
606 ".notdef",
".notdef",
".notdef",
".notdef",
"ae",
".notdef",
607 ".notdef",
".notdef",
"dotlessi",
".notdef",
".notdef",
608 "lslash",
"oslash",
"oe",
"germandbls",
".notdef",
609 ".notdef",
".notdef",
".notdef"
618 HSTEM=1, VSTEM=3, VMOVETO=4, RLINETO=5,
619 HLINETO=6, VLINETO=7, RCURVETO=8, CLOSEPATH=9,
620 CALLSUBR=10,
RETURN=11, T1ESC=12, HSBW=13,
621 ENDCHAR=14, RMOVETO=21, HMOVETO=22, VHCURVETO=30,
627 DOTSECTION=0, VSTEM3=1, HSTEM3=2, SEAC=6,
628 SBW=7, ABS=9,
ADD=10,
SUB=11,
629 DIV=12, CALLOTHERSUBR=16,
POP=17, SETCURRENTPOINT=33
637 HSTEM=1, VSTEM=3, VMOVETO=4, RLINETO=5,
638 HLINETO=6, VLINETO=7, RCURVETO=8, CALLSUBR=10,
639 RETURN=11, T2ESC=12, ENDCHAR=14, HSTEMHM=18,
640 HINTMASK=19, CNTRMASK=20, RMOVETO=21, HMOVETO=22,
641 VSTEMHM=23, RCURVELINE=24, RLINECURVE=25, VVCURVETO=26,
642 HHCURVETO=27, SHORTINT=28, CALLGSUBR=29, VHCURVETO=30,
652 DUP=27, EXCH=28,
INDEX=29, ROLL=30,
653 HFLEX=34, FLEX=35, HFLEX1=36, FLEX1=37
659 explicit CffGlobal();
667 int mnGlobalSubrBase;
668 int mnGlobalSubrCount;
669 int mnGlobalSubrBias;
674 std::vector<ValType> maFontBBox;
675 std::vector<ValType> maFontMatrix;
697 std::vector<ValType> maStemSnapH;
698 std::vector<ValType> maStemSnapV;
699 std::vector<ValType> maBlueValues;
700 std::vector<ValType> maOtherBlues;
701 std::vector<ValType> maFamilyBlues;
702 std::vector<ValType> maFamilyOtherBlues;
711const int MAX_T1OPS_SIZE = 81920;
716 U8 aOps[MAX_T1OPS_SIZE];
721class CffSubsetterContext
725 static const int NMAXSTACK = 48;
726 static const int NMAXHINTS = 2*96;
727 static const int NMAXTRANS = 32;
729 explicit CffSubsetterContext(
const U8* pBasePtr,
int nBaseLen);
731 bool initialCffRead();
732 void emitAsType1(
class Type1Emitter&,
737 void convertCharStrings(
const sal_GlyphId* pGlyphIds,
int nGlyphCount,
738 std::vector<CharString>& rCharStrings);
739 int convert2Type1Ops( CffLocal*,
const U8* pType2Ops,
int nType2Len,
U8* pType1Ops);
740 void convertOneTypeOp();
741 void convertOneTypeEsc();
742 void callType2Subr(
bool bGlobal,
int nSubrNumber);
743 sal_Int32 getReadOfs()
const {
return static_cast<sal_Int32
>(mpReadPtr - mpBasePtr);}
754 sal_Int32 mnCntrMask;
756 int seekIndexData(
int nIndexBase,
int nDataIndex);
757 void seekIndexEnd(
int nIndexBase);
759 CffLocal maCffLocal[256];
760 CffLocal* mpCffLocal;
765 int getFDSelect(
int nGlyphIndex)
const;
766 int getGlyphSID(
int nGlyphIndex)
const;
767 OString getGlyphName(
int nGlyphIndex);
768 bool getBaseAccent(
ValType aBase,
ValType aAccent,
int* nBase,
int* nAccent);
772 void writeTypeOp(
int nTypeOp);
773 void writeTypeEsc(
int nTypeOp);
774 void writeCurveTo(
int nStackPos,
int nIX1,
int nIY1,
int nIX2,
int nIY2,
int nIX3,
int nIY3);
775 void pop2MultiWrite(
int nArgsPerTypo,
int nTypeOp,
int nTypeXor=0);
776 void popAll2Write(
int nTypeOp);
781 void push(
ValType nVal) { mnValStack[ mnStackIdx++] = nVal;}
782 ValType popVal() {
return ((mnStackIdx>0) ? mnValStack[ --mnStackIdx] : 0);}
783 ValType getVal(
int nIndex)
const {
return mnValStack[
nIndex];}
785 int size()
const {
return mnStackIdx;}
786 void clear() { mnStackIdx = 0;}
789 void addHints(
bool bVerticalHints);
792 void updateWidth(
bool bUseFirstVal);
797 ValType mnValStack[ NMAXSTACK+4];
798 ValType mnTransVals[ NMAXTRANS];
802 ValType mnHintStack[ NMAXHINTS];
807 std::vector<sal_GlyphId> maExtraGlyphIds;
812CffSubsetterContext::CffSubsetterContext(
const U8* pBasePtr,
int nBaseLen)
813 : mpBasePtr( pBasePtr)
814 , mpBaseEnd( pBasePtr+nBaseLen)
817 , mpWritePtr(nullptr)
819 , mbIgnoreHints(false)
832 mpCffLocal = &maCffLocal[0];
835inline int CffSubsetterContext::popInt()
838 const int nInt =
static_cast<int>(aVal);
839 assert( nInt == aVal);
843inline void CffSubsetterContext::updateWidth(
bool bUseFirstVal)
850 maCharWidth = mpCffLocal->maNominalWidth + mnValStack[0];
853 for(
int i = 0;
i < mnStackIdx; ++
i)
854 mnValStack[ i] = mnValStack[ i+1];
856 maCharWidth = mpCffLocal->maDefaultWidth;
860void CffSubsetterContext::addHints(
bool bVerticalHints)
863 updateWidth( (mnStackIdx & 1) != 0);
870 if( mnStackIdx & 1) --mnStackIdx;
873 assert( (mnHintSize + mnStackIdx) <= 2*NMAXHINTS);
876 for(
int i = 0;
i < mnStackIdx; ++
i) {
877 nHintOfs += mnValStack[
i ];
878 mnHintStack[ mnHintSize++] = nHintOfs;
882 mnHorzHintSize = mnHintSize;
888void CffSubsetterContext::readDictOp()
890 const U8 c = *mpReadPtr;
892 int nOpId = *(mpReadPtr++);
893 const char* pCmdName =
nullptr;
897 const U8 nExtId = *(mpReadPtr++);
900 nOpId = 900 + nExtId;
909 default:
SAL_WARN(
"vcl.fonts",
"unsupported DictOp.type='" << *pCmdName <<
"'.");
break;
913 case 915: mpCffLocal->mbForceBold = nInt;
break;
919 nInt =
static_cast<int>(nVal);
921 case 10: mpCffLocal->maStemStdHW = nVal;
break;
922 case 11: mpCffLocal->maStemStdVW = nVal;
break;
923 case 15: mnCharsetBase = nInt;
break;
925 case 17: mnCharStrBase = nInt;
break;
926 case 19: mpCffLocal->mnLocalSubrOffs = nInt;
break;
927 case 20: mpCffLocal->maDefaultWidth = nVal;
break;
928 case 21: mpCffLocal->maNominalWidth = nVal;
break;
929 case 909: mpCffLocal->mfBlueScale = nVal;
break;
930 case 910: mpCffLocal->mfBlueShift = nVal;
break;
931 case 911: mpCffLocal->mfBlueFuzz = nVal;
break;
932 case 912: mpCffLocal->mfExpFactor = nVal;
break;
933 case 917: mpCffLocal->mnLangGroup = nInt;
break;
934 case 936: mnFontDictBase = nInt;
break;
935 case 937: mnFDSelectBase = nInt;
break;
941 case 5: maFontBBox.clear();
break;
942 case 907: maFontMatrix.clear();
break;
945 for(
int i = 0;
i <
size(); ++
i ) {
948 case 5: maFontBBox.push_back( nVal);
break;
949 case 907: maFontMatrix.push_back( nVal);
break;
957 for(
int i = 0;
i <
size(); ++
i ) {
960 case 6: mpCffLocal->maBlueValues.push_back( nVal);
break;
961 case 7: mpCffLocal->maOtherBlues.push_back( nVal);
break;
962 case 8: mpCffLocal->maFamilyBlues.push_back( nVal);
break;
963 case 9: mpCffLocal->maFamilyOtherBlues.push_back( nVal);
break;
964 case 912: mpCffLocal->maStemSnapH.push_back( nVal);
break;
965 case 913: mpCffLocal->maStemSnapV.push_back( nVal);
break;
974 case 2: mnFullNameSID = nInt;
break;
976 case 938: mnFontNameSID = nInt;
break;
981 mpCffLocal->mnPrivDictBase = popInt();
982 mpCffLocal->mnPrivDictSize = popInt();
994 }
else if( (c >= 32) || (c == 28) ) {
997 }
else if( c == 29 ) {
999 sal_Int32 nS32 = mpReadPtr[0] << 24;
1000 nS32 += mpReadPtr[1] << 16;
1001 nS32 += mpReadPtr[2] << 8;
1002 nS32 += mpReadPtr[3] << 0;
1006 }
else if( c == 30) {
1008 const RealType fReal = readRealVal();
1015void CffSubsetterContext::read2push()
1019 const U8*&
p = mpReadPtr;
1022 sal_Int16 nS16 = (
p[1] << 8) + p[2];
1025 }
else if( c <= 246 ) {
1026 aVal =
static_cast<ValType>(
p[0] - 139);
1028 }
else if( c <= 250 ) {
1029 aVal =
static_cast<ValType>(((
p[0] << 8) + p[1]) - 63124);
1031 }
else if( c <= 254 ) {
1032 aVal =
static_cast<ValType>(64148 - ((
p[0] << 8) + p[1]));
1035 int nS32 = (
p[1] << 24) + (p[2] << 16) + (
p[3] << 8) + p[4];
1036 if( (
sizeof(nS32) != 2) && (nS32 & (1U<<31)))
1037 nS32 |= (~0
U) << 31;
1038 aVal =
static_cast<ValType>(nS32 * (1.0 / 0x10000));
1045void CffSubsetterContext::writeType1Val(
ValType aVal)
1056 aVal = rint(aVal * 1024) / 1024;
1057 if (aVal != floor(aVal))
1059 if (aVal == rint(aVal * 64) / 64)
1066 int nInt =
static_cast<int>(rint(aVal));
1067 if (nDiv && floor(nInt) / nDiv == floor(nInt / nDiv))
1069 nInt = rint(nInt / nDiv);
1073 if( (nInt >= -107) && (nInt <= +107)) {
1074 *(
pOut++) =
static_cast<U8>(nInt + 139);
1075 }
else if( (nInt >= -1131) && (nInt <= +1131)) {
1079 nInt = 64148 - nInt;
1080 *(
pOut++) =
static_cast<U8>(nInt >> 8);
1081 *(
pOut++) =
static_cast<U8>(nInt);
1085 *(
pOut++) =
static_cast<U8>(nInt >> 24);
1086 *(
pOut++) =
static_cast<U8>(nInt >> 16);
1087 *(
pOut++) =
static_cast<U8>(nInt >> 8);
1088 *(
pOut++) =
static_cast<U8>(nInt);
1095 writeType1Val(nDiv);
1096 writeTypeEsc(TYPE1OP::DIV);
1100inline void CffSubsetterContext::writeTypeOp(
int nTypeOp)
1102 *(mpWritePtr++) =
static_cast<U8>(nTypeOp);
1105inline void CffSubsetterContext::writeTypeEsc(
int nTypeEsc)
1107 *(mpWritePtr++) = TYPE1OP::T1ESC;
1108 *(mpWritePtr++) =
static_cast<U8>(nTypeEsc);
1111void CffSubsetterContext::pop2MultiWrite(
int nArgsPerTypo,
int nTypeOp,
int nTypeXor)
1113 for(
int i = 0;
i < mnStackIdx;) {
1114 for(
int j = 0; j < nArgsPerTypo; ++j) {
1115 const ValType aVal = mnValStack[
i+j];
1116 writeType1Val( aVal);
1119 writeTypeOp( nTypeOp);
1120 nTypeOp ^= nTypeXor;
1125void CffSubsetterContext::popAll2Write(
int nTypeOp)
1128 for(
int i = 0;
i < mnStackIdx; ++
i) {
1129 const ValType aVal = mnValStack[
i];
1130 writeType1Val( aVal);
1133 writeTypeOp( nTypeOp);
1136void CffSubsetterContext::writeCurveTo(
int nStackPos,
1137 int nIX1,
int nIY1,
int nIX2,
int nIY2,
int nIX3,
int nIY3)
1140 const ValType nDX1 = nIX1 ? mnValStack[ nStackPos+nIX1 ] : 0;
1141 const ValType nDY1 = nIY1 ? mnValStack[ nStackPos+nIY1 ] : 0;
1142 const ValType nDX2 = nIX2 ? mnValStack[ nStackPos+nIX2 ] : 0;
1143 const ValType nDY2 = nIY2 ? mnValStack[ nStackPos+nIY2 ] : 0;
1144 const ValType nDX3 = nIX3 ? mnValStack[ nStackPos+nIX3 ] : 0;
1145 const ValType nDY3 = nIY3 ? mnValStack[ nStackPos+nIY3 ] : 0;
1150 writeType1Val( nDX1 );
1151 writeType1Val( nDY1 );
1152 writeType1Val( nDX2 );
1153 writeType1Val( nDY2 );
1154 writeType1Val( nDX3 );
1155 writeType1Val( nDY3 );
1156 writeTypeOp( TYPE1OP::RCURVETO );
1159void CffSubsetterContext::convertOneTypeOp()
1161 const int nType2Op = *(mpReadPtr++);
1166 case TYPE2OP::T2ESC:
1167 convertOneTypeEsc();
1169 case TYPE2OP::HSTEM:
1170 case TYPE2OP::VSTEM:
1171 addHints( nType2Op == TYPE2OP::VSTEM );
1172 for( i = 0;
i < mnHintSize;
i+=2 ) {
1173 writeType1Val( mnHintStack[i]);
1174 writeType1Val( mnHintStack[i+1] - mnHintStack[i]);
1175 writeTypeOp( nType2Op );
1178 case TYPE2OP::HSTEMHM:
1179 case TYPE2OP::VSTEMHM:
1180 addHints( nType2Op == TYPE2OP::VSTEMHM);
1182 case TYPE2OP::CNTRMASK:
1188 for( i = 0; i < mnHintSize; i+=2, nMaskBit>>=1) {
1190 nMaskByte = *(mpReadPtr++);
1193 if( !(nMaskByte & nMaskBit))
1195 if( i >= 8*
int(
sizeof(mnCntrMask)))
1196 mbIgnoreHints =
true;
1199 mnCntrMask |= (1U <<
i);
1203 case TYPE2OP::HINTMASK:
1206 sal_Int32 nHintMask = 0;
1207 int nCntrBits[2] = {0,0};
1210 int const MASK_BITS = 8*
sizeof(nHintMask);
1211 for( i = 0; i < mnHintSize; i+=2, nMaskBit>>=1) {
1213 nMaskByte = *(mpReadPtr++);
1216 if( !(nMaskByte & nMaskBit))
1219 mbIgnoreHints =
true;
1222 nHintMask |= (1U <<
i);
1223 nCntrBits[
i < mnHorzHintSize] += (mnCntrMask >>
i) & 1;
1226 mbIgnoreHints |= (nCntrBits[0] && (nCntrBits[0] != 3));
1227 mbIgnoreHints |= (nCntrBits[1] && (nCntrBits[1] != 3));
1231 for( i = 0;
i < mnHintSize;
i+=2) {
1232 if(i >= MASK_BITS || !(nHintMask & (1U << i)))
1234 writeType1Val( mnHintStack[i]);
1235 writeType1Val( mnHintStack[i+1] - mnHintStack[i]);
1236 const bool bHorz = (
i < mnHorzHintSize);
1237 if( !nCntrBits[ bHorz])
1238 writeTypeOp( bHorz ? TYPE1OP::HSTEM : TYPE1OP::VSTEM);
1239 else if( !--nCntrBits[ bHorz])
1240 writeTypeEsc( bHorz ? TYPE1OP::HSTEM3 : TYPE1OP::VSTEM3);
1244 case TYPE2OP::CALLSUBR:
1245 case TYPE2OP::CALLGSUBR:
1248 const bool bGlobal = (nType2Op == TYPE2OP::CALLGSUBR);
1249 callType2Subr( bGlobal, nInt);
1252 case TYPE2OP::RETURN:
1255 case TYPE2OP::VMOVETO:
1256 case TYPE2OP::HMOVETO:
1258 writeTypeOp( TYPE1OP::CLOSEPATH);
1260 updateWidth(
size() > 1);
1262 pop2MultiWrite( 1, nType2Op);
1264 case TYPE2OP::VLINETO:
1265 case TYPE2OP::HLINETO:
1266 pop2MultiWrite( 1, nType2Op,
1267 TYPE1OP::VLINETO ^ TYPE1OP::HLINETO);
1269 case TYPE2OP::RMOVETO:
1272 writeTypeOp( TYPE1OP::CLOSEPATH);
1274 updateWidth(
size() > 2);
1276 pop2MultiWrite( 2, nType2Op);
1278 case TYPE2OP::RLINETO:
1280 pop2MultiWrite( 2, nType2Op);
1282 case TYPE2OP::RCURVETO:
1284 pop2MultiWrite( 6, nType2Op);
1286 case TYPE2OP::RCURVELINE:
1288 while( (i += 6) <= mnStackIdx)
1289 writeCurveTo( i, -6, -5, -4, -3, -2, -1 );
1291 while( (i += 2) <= mnStackIdx) {
1292 writeType1Val( mnValStack[i-2]);
1293 writeType1Val( mnValStack[i-1]);
1294 writeTypeOp( TYPE2OP::RLINETO);
1298 case TYPE2OP::RLINECURVE:
1300 while( (i += 2) <= mnStackIdx-6) {
1301 writeType1Val( mnValStack[i-2]);
1302 writeType1Val( mnValStack[i-1]);
1303 writeTypeOp( TYPE2OP::RLINETO);
1306 while( (i += 6) <= mnStackIdx)
1307 writeCurveTo( i, -6, -5, -4, -3, -2, -1 );
1310 case TYPE2OP::VHCURVETO:
1311 case TYPE2OP::HVCURVETO:
1313 bool bVert = (nType2Op == TYPE2OP::VHCURVETO);
1316 if( mnStackIdx & 1 )
1317 nInt =
static_cast<int>(mnValStack[ --mnStackIdx ]);
1318 while( (i += 4) <= mnStackIdx) {
1320 if( bVert ) writeType1Val( 0 );
1321 writeType1Val( mnValStack[i-4] );
1322 if( !bVert ) writeType1Val( 0);
1323 writeType1Val( mnValStack[i-3] );
1324 writeType1Val( mnValStack[i-2] );
1325 if( !bVert ) writeType1Val(
static_cast<ValType>((i==mnStackIdx) ? nInt : 0) );
1326 writeType1Val( mnValStack[i-1] );
1327 if( bVert ) writeType1Val(
static_cast<ValType>((i==mnStackIdx) ? nInt : 0) );
1329 writeTypeOp( TYPE2OP::RCURVETO);
1334 case TYPE2OP::HHCURVETO:
1335 i = (mnStackIdx & 1);
1336 while( (i += 4) <= mnStackIdx) {
1338 writeCurveTo( i, -4, 0, -3, -2, -1, 0);
1340 writeCurveTo( i, -4, -5, -3, -2, -1, 0);
1344 case TYPE2OP::VVCURVETO:
1345 i = (mnStackIdx & 1);
1346 while( (i += 4) <= mnStackIdx) {
1348 writeCurveTo( i, 0, -4, -3, -2, 0, -1);
1350 writeCurveTo( i, -5, -4, -3, -2, 0, -1);
1354 case TYPE2OP::ENDCHAR:
1355 if (
size() >= 4 && mbDoSeac)
1359 auto achar = popVal();
1360 auto bchar = popVal();
1361 auto ady = popVal();
1362 auto adx = popVal();
1363 int nBase = {}, nAccent = {};
1364 if (getBaseAccent(bchar, achar, &nBase, &nAccent))
1366 maExtraGlyphIds.push_back(nBase);
1367 maExtraGlyphIds.push_back(nAccent);
1371 writeType1Val(bchar);
1372 writeType1Val(achar);
1373 writeTypeEsc(TYPE1OP::SEAC);
1377 writeTypeOp( TYPE1OP::CLOSEPATH);
1379 updateWidth(
size() >= 1);
1381 writeTypeOp( TYPE1OP::ENDCHAR);
1384 if( ((nType2Op >= 32) && (nType2Op <= 255)) || (nType2Op == 28)) {
1388 popAll2Write( nType2Op);
1389 assert(
false &&
"TODO?");
1395void CffSubsetterContext::convertOneTypeEsc()
1397 const int nType2Esc = *(mpReadPtr++);
1398 ValType* pTop = &mnValStack[ mnStackIdx-1];
1400 switch( nType2Esc) {
1402 assert( mnStackIdx >= 2 );
1403 pTop[0] =
static_cast<ValType>(
static_cast<int>(pTop[0]) &
static_cast<int>(pTop[-1]));
1407 assert( mnStackIdx >= 2 );
1408 pTop[0] =
static_cast<ValType>(
static_cast<int>(pTop[0]) |
static_cast<int>(pTop[-1]));
1412 assert( mnStackIdx >= 1 );
1413 pTop[0] =
ValType(pTop[0] == 0);
1416 assert( mnStackIdx >= 1 );
1421 assert( mnStackIdx >= 1 );
1425 assert( mnStackIdx >= 2 );
1426 pTop[0] += pTop[-1];
1430 assert( mnStackIdx >= 2 );
1431 pTop[0] -= pTop[-1];
1435 assert( mnStackIdx >= 2 );
1437 pTop[0] *= pTop[-1];
1441 assert( mnStackIdx >= 2 );
1443 pTop[0] /= pTop[-1];
1447 assert( mnStackIdx >= 2 );
1448 pTop[0] =
ValType(pTop[0] == pTop[-1]);
1452 assert( mnStackIdx >= 1 );
1455 case TYPE2OP::PUT: {
1456 assert( mnStackIdx >= 2 );
1457 const int nIdx =
static_cast<int>(pTop[0]);
1458 assert( nIdx >= 0 );
1459 assert( nIdx < NMAXTRANS );
1460 mnTransVals[ nIdx] = pTop[-1];
1464 case TYPE2OP::GET: {
1465 assert( mnStackIdx >= 1 );
1466 const int nIdx =
static_cast<int>(pTop[0]);
1467 assert( nIdx >= 0 );
1468 assert( nIdx < NMAXTRANS );
1469 pTop[0] = mnTransVals[ nIdx ];
1472 case TYPE2OP::IFELSE: {
1473 assert( mnStackIdx >= 4 );
1474 if( pTop[-1] > pTop[0] )
1475 pTop[-3] = pTop[-2];
1479 case TYPE2OP::RANDOM:
1487 assert( mnStackIdx >= 1 );
1491 case TYPE2OP::EXCH: {
1492 assert( mnStackIdx >= 2 );
1498 case TYPE2OP::INDEX: {
1499 assert( mnStackIdx >= 1 );
1500 const int nVal =
static_cast<int>(pTop[0]);
1501 assert( nVal >= 0 );
1502 assert( nVal < mnStackIdx-1 );
1503 pTop[0] = pTop[-1-nVal];
1506 case TYPE2OP::ROLL: {
1507 assert( mnStackIdx >= 1 );
1508 const int nNum =
static_cast<int>(pTop[0]);
1510 assert( nNum < mnStackIdx-2 );
1516 case TYPE2OP::HFLEX1: {
1517 assert( mnStackIdx == 9);
1519 writeCurveTo( mnStackIdx, -9, -8, -7, -6, -5, 0);
1520 writeCurveTo( mnStackIdx, -4, 0, -3, -2, -1, 0);
1526 case TYPE2OP::HFLEX: {
1527 assert( mnStackIdx == 7);
1528 ValType* pX = &mnValStack[ mnStackIdx];
1531 writeCurveTo( mnStackIdx, -7, 0, -6, -5, -4, 0);
1532 writeCurveTo( mnStackIdx, -3, 0, -2, +1, -1, 0);
1538 case TYPE2OP::FLEX: {
1539 assert( mnStackIdx == 13 );
1540 writeCurveTo( mnStackIdx, -13, -12, -11, -10, -9, -8 );
1541 writeCurveTo( mnStackIdx, -7, -6, -5, -4, -3, -2 );
1546 case TYPE2OP::FLEX1: {
1547 assert( mnStackIdx == 11 );
1549 writeCurveTo( mnStackIdx, -11, -10, -9, -8, -7, -6 );
1552 const int i = mnStackIdx;
1553 ValType nDeltaX = mnValStack[
i-11] + mnValStack[
i-9] + mnValStack[
i-7] + mnValStack[
i-5] + mnValStack[
i-3];
1554 if( nDeltaX < 0 ) nDeltaX = -nDeltaX;
1555 ValType nDeltaY = mnValStack[
i-10] + mnValStack[
i-8] + mnValStack[
i-6] + mnValStack[
i-4] + mnValStack[
i-2];
1556 if( nDeltaY < 0 ) nDeltaY = -nDeltaY;
1557 const bool bVertD6 = (nDeltaY > nDeltaX);
1561 writeCurveTo( mnStackIdx, -5, -4, -3, -2, -1, 0);
1563 writeCurveTo( mnStackIdx, -5, -4, -3, -2, 0, -1);
1568 SAL_WARN(
"vcl.fonts",
"unhandled type2esc " << nType2Esc);
1574void CffSubsetterContext::callType2Subr(
bool bGlobal,
int nSubrNumber)
1576 const U8*
const pOldReadPtr = mpReadPtr;
1577 const U8*
const pOldReadEnd = mpReadEnd;
1580 nSubrNumber += mnGlobalSubrBias;
1581 seekIndexData( mnGlobalSubrBase, nSubrNumber);
1583 nSubrNumber += mpCffLocal->mnLocalSubrBias;
1584 seekIndexData( mpCffLocal->mnLocalSubrBase, nSubrNumber);
1587 while( mpReadPtr < mpReadEnd)
1590 mpReadPtr = pOldReadPtr;
1591 mpReadEnd = pOldReadEnd;
1594int CffSubsetterContext::convert2Type1Ops( CffLocal* pCffLocal,
const U8*
const pT2Ops,
int nT2Len,
U8*
const pT1Ops)
1596 mpCffLocal = pCffLocal;
1599 mpWritePtr = pT1Ops;
1600 U8 aType1Ops[ MAX_T1OPS_SIZE];
1602 mpWritePtr = aType1Ops;
1603 *
const_cast<U8**
>(&pT1Ops) = mpWritePtr;
1606 *(mpWritePtr++) = 0x48;
1607 *(mpWritePtr++) = 0x44;
1608 *(mpWritePtr++) = 0x55;
1609 *(mpWritePtr++) =
' ';
1613 mpReadEnd = pT2Ops + nT2Len;
1617 U8* pCharWidthPtr=mpWritePtr;
1620 *(mpWritePtr++) = 255;
1621 *(mpWritePtr++) =
static_cast<U8>(0);
1622 *(mpWritePtr++) =
static_cast<U8>(0);
1623 *(mpWritePtr++) =
static_cast<U8>(250);
1624 *(mpWritePtr++) =
static_cast<U8>(124);
1625 writeTypeOp(TYPE1OP::HSBW);
1626 mbNeedClose =
false;
1627 mbIgnoreHints =
false;
1628 mnHintSize=mnHorzHintSize=mnStackIdx=0; maCharWidth=-1;
1630 while( mpReadPtr < mpReadEnd)
1632 if( maCharWidth != -1 )
1637 const int nInt =
static_cast<int>(maCharWidth);
1638 *(pCharWidthPtr++) = 255;
1639 *(pCharWidthPtr++) =
static_cast<U8>(nInt >> 24);
1640 *(pCharWidthPtr++) =
static_cast<U8>(nInt >> 16);
1641 *(pCharWidthPtr++) =
static_cast<U8>(nInt >> 8);
1642 *(pCharWidthPtr++) =
static_cast<U8>(nInt);
1645 const int nType1Len = mpWritePtr - pT1Ops;
1648 unsigned nRDCryptR = 4330;
1649 for(
U8* p = pT1Ops;
p < mpWritePtr; ++
p) {
1650 *
p ^= (nRDCryptR >> 8);
1651 nRDCryptR = (*
p + nRDCryptR) * 52845 + 22719;
1657RealType CffSubsetterContext::readRealVal()
1660 bool bComma =
false;
1666 const U8 c = *(mpReadPtr++);
1668 const U8 nH = c >> 4U;
1670 nNumber = nNumber * 10 + nH;
1672 }
else if( nH == 10) {
1675 }
else if( nH == 11) {
1679 }
else if( nH == 12) {
1683 }
else if( nH == 13) {
1685 }
else if( nH == 14)
1690 const U8 nL = c & 0x0F;
1692 nNumber = nNumber * 10 + nL;
1694 }
else if( nL == 10) {
1697 }
else if( nL == 11) {
1701 }
else if( nL == 12) {
1705 }
else if( nL == 13) {
1707 }
else if( nL == 14)
1716 if( !nExpSign) { fReal *= nNumber;}
1717 else if( nExpSign > 0) { nExpVal +=
static_cast<int>(nNumber);}
1718 else if( nExpSign < 0) { nExpVal -=
static_cast<int>(nNumber);}
1722 else if( nExpVal > 0) {
while( --nExpVal >= 0) fReal *= 10.0;}
1723 else if( nExpVal < 0) {
while( ++nExpVal <= 0) fReal /= 10.0;}
1728int CffSubsetterContext::seekIndexData(
int nIndexBase,
int nDataIndex)
1730 assert( (nIndexBase > 0) && (mpBasePtr + nIndexBase + 3 <= mpBaseEnd));
1733 mpReadPtr = mpBasePtr + nIndexBase;
1734 const int nDataCount = (mpReadPtr[0]<<8) + mpReadPtr[1];
1735 if( nDataIndex >= nDataCount)
1737 const int nDataOfsSz = mpReadPtr[2];
1738 mpReadPtr += 3 + (nDataOfsSz * nDataIndex);
1740 switch( nDataOfsSz) {
1741 default:
SAL_WARN(
"vcl.fonts",
"\tINVALID nDataOfsSz=" << nDataOfsSz);
return -1;
1742 case 1: nOfs1 = mpReadPtr[0];
break;
1743 case 2: nOfs1 = (mpReadPtr[0]<<8) + mpReadPtr[1];
break;
1744 case 3: nOfs1 = (mpReadPtr[0]<<16) + (mpReadPtr[1]<<8) + mpReadPtr[2];
break;
1745 case 4: nOfs1 = (mpReadPtr[0]<<24) + (mpReadPtr[1]<<16) + (mpReadPtr[2]<<8) + mpReadPtr[3];
break;
1747 mpReadPtr += nDataOfsSz;
1750 switch( nDataOfsSz) {
1751 case 1: nOfs2 = mpReadPtr[0];
break;
1752 case 2: nOfs2 = (mpReadPtr[0]<<8) + mpReadPtr[1];
break;
1753 case 3: nOfs2 = (mpReadPtr[0]<<16) + (mpReadPtr[1]<<8) + mpReadPtr[2];
break;
1754 case 4: nOfs2 = (mpReadPtr[0]<<24) + (mpReadPtr[1]<<16) + (mpReadPtr[2]<<8) + mpReadPtr[3];
break;
1757 mpReadPtr = mpBasePtr + (nIndexBase + 2) + nDataOfsSz * (nDataCount + 1) + nOfs1;
1758 mpReadEnd = mpReadPtr + (nOfs2 - nOfs1);
1759 assert( nOfs1 >= 0);
1760 assert( nOfs2 >= nOfs1);
1761 assert( mpReadPtr <= mpBaseEnd);
1762 assert( mpReadEnd <= mpBaseEnd);
1763 return (nOfs2 - nOfs1);
1767void CffSubsetterContext::seekIndexEnd(
int nIndexBase)
1769 assert( (nIndexBase > 0) && (mpBasePtr + nIndexBase + 3 <= mpBaseEnd));
1770 mpReadPtr = mpBasePtr + nIndexBase;
1771 const int nDataCount = (mpReadPtr[0]<<8) + mpReadPtr[1];
1772 const int nDataOfsSz = mpReadPtr[2];
1773 mpReadPtr += 3 + nDataOfsSz * nDataCount;
1774 assert( mpReadPtr <= mpBaseEnd);
1776 switch( nDataOfsSz) {
1777 default:
SAL_WARN(
"vcl.fonts",
"\tINVALID nDataOfsSz=" << nDataOfsSz);
return;
1778 case 1: nEndOfs = mpReadPtr[0];
break;
1779 case 2: nEndOfs = (mpReadPtr[0]<<8) + mpReadPtr[1];
break;
1780 case 3: nEndOfs = (mpReadPtr[0]<<16) + (mpReadPtr[1]<<8) + mpReadPtr[2];
break;
1781 case 4: nEndOfs = (mpReadPtr[0]<<24) + (mpReadPtr[1]<<16) + (mpReadPtr[2]<<8) + mpReadPtr[3];
break;
1783 mpReadPtr += nDataOfsSz;
1784 mpReadPtr += nEndOfs - 1;
1785 mpReadEnd = mpBaseEnd;
1786 assert( nEndOfs >= 0);
1787 assert( mpReadEnd <= mpBaseEnd);
1794, mnLocalSubrOffs( 0)
1795, mnLocalSubrBase( 0)
1796, mnLocalSubrBias( 0)
1806, mbForceBold( false)
1810CffGlobal::CffGlobal()
1812, mnStringIdxBase( 0)
1817, mnGlobalSubrBase( 0)
1818, mnGlobalSubrCount( 0)
1819, mnGlobalSubrBias( 0)
1828bool CffSubsetterContext::initialCffRead()
1831 mpReadPtr = mpBasePtr;
1832 const U8 nVerMajor = *(mpReadPtr++);
1833 const U8 nVerMinor = *(mpReadPtr++);
1834 const U8 nHeaderSize = *(mpReadPtr++);
1835 const U8 nOffsetSize = *(mpReadPtr++);
1837 assert( (nVerMajor == 1) && (nVerMinor == 0));
1838 (void)(nVerMajor + nVerMinor + nOffsetSize);
1841 mnNameIdxBase = nHeaderSize;
1842 mpReadPtr = mpBasePtr + nHeaderSize;
1843 seekIndexEnd( mnNameIdxBase);
1846 const sal_Int32 nTopDictBase = getReadOfs();
1847 const int nTopDictCount = (mpReadPtr[0]<<8) + mpReadPtr[1];
1848 if( nTopDictCount) {
1849 for(
int i = 0;
i < nTopDictCount; ++
i) {
1850 seekIndexData( nTopDictBase, i);
1851 while( mpReadPtr < mpReadEnd)
1853 assert( mpReadPtr == mpReadEnd);
1858 mnStringIdxBase = getReadOfs();
1859 seekIndexEnd( mnStringIdxBase);
1862 mnGlobalSubrBase = getReadOfs();
1863 mnGlobalSubrCount = (mpReadPtr[0]<<8) + mpReadPtr[1];
1864 mnGlobalSubrBias = (mnGlobalSubrCount<1240)?107:(mnGlobalSubrCount<33900)?1131:32768;
1875 mpReadPtr = mpBasePtr + mnCharStrBase;
1876 mnCharStrCount = (mpReadPtr[0]<<8) + mpReadPtr[1];
1882 mpReadPtr = mpBasePtr + mnFontDictBase;
1883 mnFDAryCount = (mpReadPtr[0]<<8) + mpReadPtr[1];
1886 SAL_INFO(
"vcl.fonts",
"CffSubsetterContext: too many CFF in font");
1891 for(
int i = 0;
i < mnFDAryCount; ++
i) {
1892 mpCffLocal = &maCffLocal[
i];
1893 seekIndexData( mnFontDictBase, i);
1894 while( mpReadPtr < mpReadEnd)
1896 assert( mpReadPtr == mpReadEnd);
1900 for(
int i = 0;
i < mnFDAryCount; ++
i) {
1901 mpCffLocal = &maCffLocal[
i];
1905 if( mpCffLocal->mnPrivDictSize != 0) {
1906 assert( mpCffLocal->mnPrivDictSize > 0);
1908 mpReadPtr = mpBasePtr + mpCffLocal->mnPrivDictBase;
1909 mpReadEnd = mpReadPtr + mpCffLocal->mnPrivDictSize;
1910 assert( mpReadEnd <= mpBaseEnd);
1912 while( mpReadPtr < mpReadEnd)
1917 if( mpCffLocal->mnLocalSubrOffs) {
1919 mpCffLocal->mnLocalSubrBase = mpCffLocal->mnPrivDictBase + mpCffLocal->mnLocalSubrOffs;
1920 mpReadPtr = mpBasePtr + mpCffLocal->mnLocalSubrBase;
1921 const int nSubrCount = (mpReadPtr[0] << 8) + mpReadPtr[1];
1922 mpCffLocal->mnLocalSubrBias = (nSubrCount<1240)?107:(nSubrCount<33900)?1131:32768;
1933OString CffSubsetterContext::getString(
int nStringID)
1937 if( (nStringID >= 0) && (nStringID < nStdStrings))
1943 nStringID -= nStdStrings;
1944 int nLen = seekIndexData( mnStringIdxBase, nStringID);
1948 return "name[" + OString::number(nStringID) +
"].notfound!";
1950 const int nMaxLen = 2560 - 1;
1951 if( nLen >= nMaxLen)
1953 return OString(
reinterpret_cast<char const *
>(mpReadPtr), nLen);
1958int CffSubsetterContext::getFDSelect(
int nGlyphIndex)
const
1960 assert( nGlyphIndex >= 0);
1961 assert( nGlyphIndex < mnCharStrCount);
1965 const U8* pReadPtr = mpBasePtr + mnFDSelectBase;
1966 const U8 nFDSelFormat = *(pReadPtr++);
1967 switch( nFDSelFormat) {
1969 pReadPtr += nGlyphIndex;
1970 const U8 nFDIdx = *(pReadPtr++);
1974 const U16 nRangeCount = (pReadPtr[0]<<8) + pReadPtr[1];
1975 assert( nRangeCount > 0);
1976 assert( nRangeCount <= mnCharStrCount);
1977 U16 nPrev = (pReadPtr[2]<<8) + pReadPtr[3];
1978 assert( nPrev == 0);
1982 for(
int i = 0;
i < nRangeCount; ++
i) {
1983 const U8 nFDIdx = pReadPtr[0];
1984 const U16 nNext = (pReadPtr[1]<<8) + pReadPtr[2];
1985 assert( nPrev < nNext);
1986 if( nGlyphIndex < nNext)
1993 SAL_WARN(
"vcl.fonts",
"invalid CFF.FdselType=" << nFDSelFormat);
2001int CffSubsetterContext::getGlyphSID(
int nGlyphIndex)
const
2003 if( nGlyphIndex == 0)
2005 assert( nGlyphIndex >= 0);
2006 assert( nGlyphIndex < mnCharStrCount);
2007 if( (nGlyphIndex < 0) || (nGlyphIndex >= mnCharStrCount))
2011 const U8* pReadPtr = mpBasePtr + mnCharsetBase;
2012 const U8 nCSetFormat = *(pReadPtr++);
2013 int nGlyphsToSkip = nGlyphIndex - 1;
2014 switch( nCSetFormat) {
2016 pReadPtr += 2 * nGlyphsToSkip;
2020 while( nGlyphsToSkip >= 0) {
2021 const int nLeft = pReadPtr[2];
2022 if( nGlyphsToSkip <= nLeft)
2024 nGlyphsToSkip -= nLeft + 1;
2029 while( nGlyphsToSkip >= 0) {
2030 const int nLeft = (pReadPtr[2]<<8) + pReadPtr[3];
2031 if( nGlyphsToSkip <= nLeft)
2033 nGlyphsToSkip -= nLeft + 1;
2038 SAL_WARN(
"vcl.fonts",
"ILLEGAL CFF-Charset format " << nCSetFormat);
2042 int nSID = (pReadPtr[0]<<8) + pReadPtr[1];
2043 nSID += nGlyphsToSkip;
2049OString CffSubsetterContext::getGlyphName(
int nGlyphIndex)
2052 if( nGlyphIndex == 0)
2056 const int nSID = getGlyphSID( nGlyphIndex);
2059 char aDefaultGlyphName[64];
2061 return aDefaultGlyphName;
2065 char aDefaultGlyphName[64];
2067 return aDefaultGlyphName;
2072 const char*
p = pSidName.getStr();
2073 while( (*p >=
'0') && (*p <=
'z')) ++
p;
2074 if( (p >= pSidName.getStr()+1) && (*p ==
'\0'))
2077 char aDefaultGlyphName[64];
2079 return aDefaultGlyphName;
2083bool CffSubsetterContext::getBaseAccent(
ValType aBase,
ValType aAccent,
int* nBase,
int* nAccent)
2085 bool bBase =
false, bAccent =
false;
2086 for (
int i = 0;
i < mnCharStrCount;
i++)
2088 OString pGlyphName = getGlyphName(i);
2099 if (bBase && bAccent)
2110 explicit Type1Emitter(
SvStream* pOutFile,
bool bPfbSubset);
2112 void setSubsetName(
const char* );
2114 size_t emitRawData(
const char* pData,
size_t nLength)
const;
2117 void emitAllCrypted();
2118 int tellPos()
const;
2119 void updateLen(
int nTellPos,
size_t nLength);
2120 void emitValVector(
const char* pLineHead,
const char* pLineTail,
const std::vector<ValType>&);
2123 unsigned mnEECryptR;
2125 OStringBuffer maBuffer;
2127 char maSubsetName[256];
2134Type1Emitter::Type1Emitter(
SvStream* pOutFile,
bool bPfbSubset)
2135: mpFileOut( pOutFile)
2137, mbPfbSubset( bPfbSubset)
2140 maSubsetName[0] =
'\0';
2143Type1Emitter::~Type1Emitter()
2147 mpFileOut =
nullptr;
2150void Type1Emitter::setSubsetName(
const char* pSubsetName)
2152 maSubsetName[0] =
'\0';
2154 strncpy( maSubsetName, pSubsetName,
sizeof(maSubsetName) - 1);
2155 maSubsetName[
sizeof(maSubsetName)-1] =
'\0';
2158int Type1Emitter::tellPos()
const
2160 int nTellPos = mpFileOut->Tell();
2164void Type1Emitter::updateLen(
int nTellPos,
size_t nLength)
2168 cData[0] =
static_cast<U8>(
nLength >> 0);
2169 cData[1] =
static_cast<U8>(
nLength >> 8);
2170 cData[2] =
static_cast<U8>(
nLength >> 16);
2171 cData[3] =
static_cast<U8>(
nLength >> 24);
2175 if (mpFileOut->Seek(nTellPos) !=
static_cast<sal_uInt64
>(nTellPos))
2177 mpFileOut->WriteBytes(cData,
sizeof(cData));
2178 mpFileOut->Seek(nCurrPos);
2181inline size_t Type1Emitter::emitRawData(
const char* pData,
size_t nLength)
const
2183 return mpFileOut->WriteBytes( pData, nLength );
2186inline void Type1Emitter::emitAllRaw()
2189 emitRawData( maBuffer.getStr(), maBuffer.getLength());
2191 maBuffer.setLength(0);
2194inline void Type1Emitter::emitAllHex()
2196 auto const end = maBuffer.getStr() + maBuffer.getLength();
2197 for(
const char* p = maBuffer.getStr(); p < end;) {
2199 char aHexBuf[0x4000];
2200 char*
pOut = aHexBuf;
2201 while( (p < end) && (pOut < aHexBuf+
sizeof(aHexBuf)-4)) {
2203 char cNibble = (
static_cast<unsigned char>(*p) >> 4) & 0x0F;
2204 cNibble += (cNibble < 10) ?
'0' :
'A'-10;
2205 *(
pOut++) = cNibble;
2206 cNibble = *(
p++) & 0x0F;
2207 cNibble += (cNibble < 10) ?
'0' :
'A'-10;
2208 *(
pOut++) = cNibble;
2210 if( (++mnHexLineCol & 0x3F) == 0)
2214 emitRawData( aHexBuf, pOut-aHexBuf);
2217 maBuffer.setLength(0);
2220void Type1Emitter::emitAllCrypted()
2223 for( sal_Int32 i = 0;
i < maBuffer.getLength(); ++
i) {
2224 maBuffer[
i] ^= (mnEECryptR >> 8);
2225 mnEECryptR = (
static_cast<U8>(maBuffer[
i]) + mnEECryptR) * 52845 + 22719;
2239 return rtl::math::doubleToString(fVal, rtl_math_StringFormat_G, 6,
'.',
true);
2242void Type1Emitter::emitValVector(
const char* pLineHead,
const char* pLineTail,
2243 const std::vector<ValType>& rVector)
2246 if( rVector.empty())
2250 maBuffer.append( pLineHead);
2252 std::vector<ValType>::value_type aVal = 0;
2253 for( std::vector<ValType>::const_iterator it = rVector.begin();;) {
2255 if( ++it == rVector.end() )
2257 maBuffer.append(
dbl2str( aVal));
2258 maBuffer.append(
' ');
2261 maBuffer.append(
dbl2str( aVal));
2263 maBuffer.append( pLineTail);
2266void CffSubsetterContext::convertCharStrings(
const sal_GlyphId* pGlyphIds,
int nGlyphCount,
2267 std::vector<CharString>& rCharStrings)
2271 bool bCheckDuplicates = !rCharStrings.empty();
2272 rCharStrings.reserve(rCharStrings.size() + nGlyphCount);
2273 for (
int i = 0;
i < nGlyphCount; ++
i)
2275 const int nCffGlyphId = pGlyphIds[
i];
2276 assert((nCffGlyphId >= 0) && (nCffGlyphId < mnCharStrCount));
2278 if (!bCheckDuplicates)
2281 = std::find_if(rCharStrings.begin(), rCharStrings.end(),
2282 [&](
const CharString& c) { return c.nCffGlyphId == nCffGlyphId; });
2283 if (it != rCharStrings.end())
2288 const int nFDSelect = getFDSelect(nCffGlyphId);
2291 mpCffLocal = &maCffLocal[nFDSelect];
2294 const int nT2Len = seekIndexData(mnCharStrBase, nCffGlyphId);
2298 const int nT1Len = convert2Type1Ops(mpCffLocal, mpReadPtr, nT2Len, aCharString.aOps);
2299 aCharString.nLen = nT1Len;
2300 aCharString.nCffGlyphId = nCffGlyphId;
2302 rCharStrings.push_back(aCharString);
2306void CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter,
2311 static const int nUniqueIdBase = 4100000;
2312 static int nUniqueId = nUniqueIdBase;
2315 char* pFontName = rEmitter.maSubsetName;
2317 if( mnFontNameSID) {
2320 pFontName,
getString( mnFontNameSID).getStr(),
sizeof(rEmitter.maSubsetName) - 1);
2321 pFontName[
sizeof(rEmitter.maSubsetName) - 1] = 0;
2322 }
else if( mnFullNameSID) {
2324 auto const str =
getString( mnFullNameSID);
2325 const char* pI = str.getStr();
2326 char* pO = pFontName;
2327 const char* pLimit = pFontName +
sizeof(rEmitter.maSubsetName) - 1;
2328 while( pO < pLimit) {
2329 const char c = *(pI++);
2338 strncpy( pFontName,
"DummyName",
sizeof(rEmitter.maSubsetName));
2341 const char* pFullName = pFontName;
2342 const char* pFamilyName = pFontName;
2345 if( rEmitter.mbPfbSubset ) {
2346 static const char aPfbHeader[] =
"\x80\x01\x00\x00\x00\x00";
2347 rEmitter.emitRawData( aPfbHeader,
sizeof(aPfbHeader)-1);
2350 rEmitter.maBuffer.append(
2351 "%!FontType1-1.0: " + OString::Concat(rEmitter.maSubsetName) +
" 001.003\n");
2353 rEmitter.maBuffer.append(
2356 "/PaintType 0 def\n");
2357 rEmitter.maBuffer.append(
"/FontName /" + OString::Concat(rEmitter.maSubsetName) +
" def\n");
2358 rEmitter.maBuffer.append(
"/UniqueID " + OString::number(nUniqueId) +
" def\n");
2360 if( maFontMatrix.size() == 6)
2361 rEmitter.emitValVector(
"/FontMatrix [",
"]readonly def\n", maFontMatrix);
2363 rEmitter.maBuffer.append(
"/FontMatrix [0.001 0 0 0.001 0 0]readonly def\n");
2368 if( maFontMatrix.size() >= 4) {
2369 fXFactor = 1000.0F * maFontMatrix[0];
2370 fYFactor = 1000.0F * maFontMatrix[3];
2373 auto aFontBBox = maFontBBox;
2379 else if (aFontBBox.size() != 4)
2380 aFontBBox = { 0, 0, 999, 999 };
2381 rEmitter.emitValVector(
"/FontBBox {",
"}readonly def\n", aFontBBox);
2383 rEmitter.maBuffer.append(
2384 "/FontInfo 2 dict dup begin\n"
2385 " /FullName (" + OString::Concat(pFullName) +
") readonly def\n"
2386 " /FamilyName (" + pFamilyName +
") readonly def\n"
2387 "end readonly def\n");
2389 rEmitter.maBuffer.append(
2390 "/Encoding 256 array\n"
2391 "0 1 255 {1 index exch /.notdef put} for\n");
2392 for(
int i = 1; (
i < nGlyphCount) && (i < 256); ++
i) {
2393 OString pGlyphName = getGlyphName( pReqGlyphIds[i]);
2394 rEmitter.maBuffer.append(
2395 "dup " + OString::number(pReqEncoding[i]) +
" /" + pGlyphName +
" put\n");
2397 rEmitter.maBuffer.append(
"readonly def\n");
2398 rEmitter.maBuffer.append(
2401 "currentfile eexec\n");
2404 rEmitter.emitAllRaw();
2405 if( rEmitter.mbPfbSubset) {
2407 const int nPfbHeaderLen = rEmitter.tellPos() - 6;
2408 rEmitter.updateLen( 2, nPfbHeaderLen);
2411 rEmitter.emitRawData(
"\x80\x02\x00\x00\x00\x00", 6);
2413 const int nEExecSegTell = rEmitter.tellPos();
2417 int nPrivEntryCount = 9;
2419 nPrivEntryCount +=
int(!mpCffLocal->maOtherBlues.empty());
2420 nPrivEntryCount +=
int(!mpCffLocal->maFamilyBlues.empty());
2421 nPrivEntryCount +=
int(!mpCffLocal->maFamilyOtherBlues.empty());
2422 nPrivEntryCount +=
int(mpCffLocal->mfBlueScale != 0.0);
2423 nPrivEntryCount +=
int(mpCffLocal->mfBlueShift != 0.0);
2424 nPrivEntryCount +=
int(mpCffLocal->mfBlueFuzz != 0.0);
2426 nPrivEntryCount +=
int(mpCffLocal->maStemStdHW != 0);
2427 nPrivEntryCount +=
int(mpCffLocal->maStemStdVW != 0);
2428 nPrivEntryCount +=
int(!mpCffLocal->maStemSnapH.empty());
2429 nPrivEntryCount +=
int(!mpCffLocal->maStemSnapV.empty());
2431 nPrivEntryCount +=
int(mpCffLocal->mfExpFactor != 0.0);
2432 nPrivEntryCount +=
int(mpCffLocal->mnLangGroup != 0);
2433 nPrivEntryCount +=
int(mpCffLocal->mnLangGroup == 1);
2434 nPrivEntryCount +=
int(mpCffLocal->mbForceBold);
2436 rEmitter.maBuffer.append(
2438 "dup\n/Private " + OString::number(nPrivEntryCount) +
" dict dup begin\n"
2439 "/RD{string currentfile exch readstring pop}executeonly def\n"
2440 "/ND{noaccess def}executeonly def\n"
2441 "/NP{noaccess put}executeonly def\n"
2442 "/MinFeature{16 16}ND\n"
2443 "/password 5839 def\n");
2446 if( !mpCffLocal->maBlueValues.empty())
2447 rEmitter.emitValVector(
"/BlueValues [",
"]ND\n", mpCffLocal->maBlueValues);
2449 rEmitter.maBuffer.append(
"/BlueValues []ND\n");
2450 rEmitter.emitValVector(
"/OtherBlues [",
"]ND\n", mpCffLocal->maOtherBlues);
2451 rEmitter.emitValVector(
"/FamilyBlues [",
"]ND\n", mpCffLocal->maFamilyBlues);
2452 rEmitter.emitValVector(
"/FamilyOtherBlues [",
"]ND\n", mpCffLocal->maFamilyOtherBlues);
2454 if( mpCffLocal->mfBlueScale) {
2455 rEmitter.maBuffer.append(
"/BlueScale ");
2456 rEmitter.maBuffer.append(
dbl2str( mpCffLocal->mfBlueScale));
2457 rEmitter.maBuffer.append(
" def\n");
2459 if( mpCffLocal->mfBlueShift) {
2460 rEmitter.maBuffer.append(
"/BlueShift ");
2461 rEmitter.maBuffer.append(
dbl2str( mpCffLocal->mfBlueShift));
2462 rEmitter.maBuffer.append(
" def\n");
2464 if( mpCffLocal->mfBlueFuzz) {
2465 rEmitter.maBuffer.append(
"/BlueFuzz ");
2466 rEmitter.maBuffer.append(
dbl2str( mpCffLocal->mfBlueFuzz));
2467 rEmitter.maBuffer.append(
" def\n");
2471 if( mpCffLocal->maStemStdHW) {
2472 rEmitter.maBuffer.append(
"/StdHW [");
2473 rEmitter.maBuffer.append(
dbl2str( mpCffLocal->maStemStdHW));
2474 rEmitter.maBuffer.append(
"] def\n");
2476 if( mpCffLocal->maStemStdVW) {
2477 rEmitter.maBuffer.append(
"/StdVW [");
2478 rEmitter.maBuffer.append(
dbl2str( mpCffLocal->maStemStdVW));
2479 rEmitter.maBuffer.append(
"] def\n");
2481 rEmitter.emitValVector(
"/StemSnapH [",
"]ND\n", mpCffLocal->maStemSnapH);
2482 rEmitter.emitValVector(
"/StemSnapV [",
"]ND\n", mpCffLocal->maStemSnapV);
2485 if( mpCffLocal->mbForceBold)
2486 rEmitter.maBuffer.append(
"/ForceBold true def\n");
2487 if( mpCffLocal->mnLangGroup != 0)
2488 rEmitter.maBuffer.append(
2489 "/LanguageGroup " + OString::number(mpCffLocal->mnLangGroup) +
" def\n");
2490 if( mpCffLocal->mnLangGroup == 1)
2491 rEmitter.maBuffer.append(
"/RndStemUp false def\n");
2492 if( mpCffLocal->mfExpFactor) {
2493 rEmitter.maBuffer.append(
"/ExpansionFactor ");
2494 rEmitter.maBuffer.append(
dbl2str( mpCffLocal->mfExpFactor));
2495 rEmitter.maBuffer.append(
" def\n");
2499 rEmitter.maBuffer.append(
"/UniqueID " + OString::number(nUniqueId) +
" def\n");
2502 rEmitter.maBuffer.append(
2504 "% Dummy code for faking flex hints\n"
2505 "[ {} {} {} {systemdict /internaldict known not {pop 3}\n"
2506 "{1183615869 systemdict /internaldict get exec\n"
2507 "dup /startlock known\n"
2508 "{/startlock get exec}\n"
2509 "{dup /strtlck known\n"
2510 "{/strtlck get exec}\n"
2511 "{pop 3}\nifelse}\nifelse}\nifelse\n} executeonly\n"
2517 rEmitter.maBuffer.append(
2519 "dup 0 15 RD \x5F\x3D\x6B\xAC\x3C\xBD\x74\x3D\x3E\x17\xA0\x86\x58\x08\x85 NP\n"
2520 "dup 1 9 RD \x5F\x3D\x6B\xD8\xA6\xB5\x68\xB6\xA2 NP\n"
2521 "dup 2 9 RD \x5F\x3D\x6B\xAC\x39\x46\xB9\x43\xF9 NP\n"
2522 "dup 3 5 RD \x5F\x3D\x6B\xAC\xB9 NP\n"
2523 "dup 4 12 RD \x5F\x3D\x6B\xAC\x3E\x5D\x48\x54\x62\x76\x39\x03 NP\n"
2530 std::vector<CharString> aCharStrings;
2532 convertCharStrings(pReqGlyphIds, nGlyphCount, aCharStrings);
2536 if (!maExtraGlyphIds.empty())
2539 convertCharStrings(maExtraGlyphIds.data(), maExtraGlyphIds.size(), aCharStrings);
2541 rEmitter.maBuffer.append(
2542 "2 index /CharStrings " + OString::number(aCharStrings.size()) +
" dict dup begin\n");
2543 rEmitter.emitAllCrypted();
2544 for (
const auto& rCharString : aCharStrings)
2547 OString pGlyphName = getGlyphName(rCharString.nCffGlyphId);
2549 rEmitter.maBuffer.append(
2550 "/" + pGlyphName +
" " + OString::number(rCharString.nLen) +
" RD ");
2551 rEmitter.maBuffer.append(
2552 reinterpret_cast<char const *
>(rCharString.aOps), rCharString.nLen);
2553 rEmitter.maBuffer.append(
" ND\n");
2554 rEmitter.emitAllCrypted();
2557 rEmitter.maBuffer.append(
"end end\nreadonly put\nput\n");
2558 rEmitter.maBuffer.append(
"dup/FontName get exch definefont pop\n");
2559 rEmitter.maBuffer.append(
"mark currentfile closefile\n");
2560 rEmitter.emitAllCrypted();
2563 if( rEmitter.mbPfbSubset) {
2564 const int nEExecLen = rEmitter.tellPos() - nEExecSegTell;
2565 rEmitter.updateLen( nEExecSegTell-4, nEExecLen);
2569 static const char aPfxFooter[] =
"\x80\x01\x14\x02\x00\x00\n"
2570 "0000000000000000000000000000000000000000000000000000000000000000\n"
2571 "0000000000000000000000000000000000000000000000000000000000000000\n"
2572 "0000000000000000000000000000000000000000000000000000000000000000\n"
2573 "0000000000000000000000000000000000000000000000000000000000000000\n"
2574 "0000000000000000000000000000000000000000000000000000000000000000\n"
2575 "0000000000000000000000000000000000000000000000000000000000000000\n"
2576 "0000000000000000000000000000000000000000000000000000000000000000\n"
2577 "0000000000000000000000000000000000000000000000000000000000000000\n"
2580 if( rEmitter.mbPfbSubset)
2581 rEmitter.emitRawData( aPfxFooter,
sizeof(aPfxFooter)-1);
2583 rEmitter.emitRawData( aPfxFooter+6,
sizeof(aPfxFooter)-9);
2594 rFSInfo.
m_aFontBBox = {
Point(
static_cast<sal_Int32
>(aFontBBox[0] * fXFactor),
2595 static_cast<sal_Int32
>(aFontBBox[1] * fYFactor)),
2596 Point(
static_cast<sal_Int32
>(aFontBBox[2] * fXFactor),
2597 static_cast<sal_Int32
>(aFontBBox[3] * fYFactor)) };
2604 rFSInfo.
m_aPSName = OUString( rEmitter.maSubsetName, strlen(rEmitter.maSubsetName), RTL_TEXTENCODING_UTF8 );
2610 bool bRC = aCff.initialCffRead();
2617 Type1Emitter aType1Emitter(
mpOutFile, bPfbSubset);
2619 aCff.emitAsType1( aType1Emitter,
constexpr OStringLiteral tok_Medium
constexpr OStringLiteral tok_Agravesmall
constexpr OStringLiteral tok_Scaron
constexpr OStringLiteral tok_uacute
constexpr OStringLiteral tok_eightoldstyle
constexpr OStringLiteral tok_Lslash
constexpr OStringLiteral tok_dagger
static const char * pStandardEncoding[]
constexpr OStringLiteral tok_zerosuperior
constexpr OStringLiteral tok_dsuperior
constexpr OStringLiteral tok_paragraph
constexpr OStringLiteral tok_fourinferior
constexpr OStringLiteral tok_D
constexpr OStringLiteral tok_Ucircumflexsmall
constexpr OStringLiteral tok_ucircumflex
constexpr OStringLiteral tok_ring
constexpr OStringLiteral tok_parenleft
constexpr OStringLiteral tok_001_003
static const char * pDictOps[]
constexpr OStringLiteral tok_u
constexpr OStringLiteral tok_cent
constexpr OStringLiteral tok_egrave
constexpr OStringLiteral tok_S
constexpr OStringLiteral tok_Yacute
constexpr OStringLiteral tok_Roman
constexpr OStringLiteral tok_currency
constexpr OStringLiteral tok_Odieresis
constexpr OStringLiteral tok_Macronsmall
constexpr OStringLiteral tok_ellipsis
constexpr OStringLiteral tok_Acircumflex
constexpr OStringLiteral tok_periodsuperior
constexpr OStringLiteral tok_sterlin
constexpr OStringLiteral tok_dollarinferior
constexpr OStringLiteral tok_J
constexpr OStringLiteral tok_colon
constexpr OStringLiteral tok_section
constexpr OStringLiteral tok_L
constexpr OStringLiteral tok_ccedilla
constexpr OStringLiteral tok_Ograve
constexpr OStringLiteral tok_quotedblbase
constexpr OStringLiteral tok_fivesuperior
constexpr OStringLiteral tok_Agrave
constexpr OStringLiteral tok_aacute
constexpr OStringLiteral tok_nineoldstile
constexpr OStringLiteral tok_space
constexpr OStringLiteral tok_Semibold
constexpr OStringLiteral tok_backslash
constexpr OStringLiteral tok_h
constexpr OStringLiteral tok_onehalf
constexpr OStringLiteral tok_Ydieresis
constexpr OStringLiteral tok_rsuperior
constexpr OStringLiteral tok_Ugravesmall
constexpr OStringLiteral tok_parenleftinferior
constexpr OStringLiteral tok_numbersign
constexpr OStringLiteral tok_igrave
constexpr OStringLiteral tok_sevenoldstyle
constexpr OStringLiteral tok_breve
constexpr OStringLiteral tok_Asmall
constexpr OStringLiteral tok_Ocircumflexsmall
constexpr OStringLiteral tok_ecircumflex
constexpr OStringLiteral tok_X
constexpr OStringLiteral tok_ograve
constexpr OStringLiteral tok_centinferior
constexpr OStringLiteral tok_Ysmall
constexpr OStringLiteral tok_braceleft
constexpr OStringLiteral tok_notdef
constexpr OStringLiteral tok_florin
constexpr OStringLiteral tok_Otilde
constexpr OStringLiteral tok_udieresis
constexpr OStringLiteral tok_ff
constexpr OStringLiteral tok_A
constexpr OStringLiteral tok_d
constexpr OStringLiteral tok_Black
constexpr OStringLiteral tok_Hungarumlautsmall
constexpr OStringLiteral tok_Zcaronsmall
constexpr OStringLiteral tok_four
constexpr OStringLiteral tok_parenleftsuperior
constexpr OStringLiteral tok_W
constexpr OStringLiteral tok_quoteleft
constexpr OStringLiteral tok_parenrightinferior
constexpr OStringLiteral tok_exclamdown
constexpr OStringLiteral tok_threequartersemdash
constexpr OStringLiteral tok_threequarters
constexpr OStringLiteral tok_Thornsmall
constexpr OStringLiteral tok_hungarumlaut
constexpr OStringLiteral tok_copyright
constexpr OStringLiteral tok_Adieresissmall
constexpr OStringLiteral tok_Ringsmall
constexpr OStringLiteral tok_Udieresis
constexpr OStringLiteral tok_germandbls
constexpr OStringLiteral tok_commainferior
constexpr OStringLiteral tok_Aacute
constexpr OStringLiteral tok_edieresis
constexpr OStringLiteral tok_scaron
constexpr OStringLiteral tok_i
constexpr OStringLiteral tok_Ksmall
constexpr OStringLiteral tok_j
constexpr OStringLiteral tok_period
constexpr OStringLiteral tok_e
constexpr OStringLiteral tok_Ecircumflexsmall
constexpr OStringLiteral tok_t
constexpr OStringLiteral tok_ninesuperior
constexpr OStringLiteral tok_T
constexpr OStringLiteral tok_Ismall
constexpr OStringLiteral tok_tilde
constexpr OStringLiteral tok_commasuperior
constexpr OStringLiteral tok_Q
constexpr OStringLiteral tok_at
constexpr OStringLiteral tok_quotedblleft
constexpr OStringLiteral tok_sevensuperior
constexpr OStringLiteral tok_AE
constexpr OStringLiteral tok_tsuperior
constexpr OStringLiteral tok_Usmall
constexpr OStringLiteral tok_N
constexpr OStringLiteral tok_twoinferior
constexpr OStringLiteral tok_thorn
constexpr OStringLiteral tok_six
constexpr OStringLiteral tok_Icircumflex
constexpr OStringLiteral tok_hyphen
constexpr OStringLiteral tok_Brevesmall
constexpr OStringLiteral tok_zerooldstyle
constexpr OStringLiteral tok_percent
constexpr OStringLiteral tok_Ntilde
constexpr OStringLiteral tok_logicalnot
constexpr OStringLiteral tok_exclamdownsmall
constexpr OStringLiteral tok_Osmall
constexpr OStringLiteral tok_lslash
constexpr OStringLiteral tok_esuperior
constexpr OStringLiteral tok_Ssmall
constexpr OStringLiteral tok_quotedblright
constexpr OStringLiteral tok_001_001
constexpr OStringLiteral tok_threeoldstyle
constexpr OStringLiteral tok_Ogoneksmall
constexpr OStringLiteral tok_Idieresissmall
constexpr OStringLiteral tok_Ntildesmall
constexpr OStringLiteral tok_rupia
constexpr OStringLiteral tok_seveninferior
constexpr OStringLiteral tok_acircumflex
constexpr OStringLiteral tok_Igravesmall
constexpr OStringLiteral tok_Csmall
constexpr OStringLiteral tok_degree
constexpr OStringLiteral tok_C
constexpr OStringLiteral tok_l
constexpr OStringLiteral tok_bracketleft
constexpr OStringLiteral tok_brokenbar
constexpr OStringLiteral tok_k
constexpr OStringLiteral tok_twothirds
constexpr OStringLiteral tok_q
constexpr OStringLiteral tok_onethird
constexpr OStringLiteral tok_registered
constexpr OStringLiteral tok_yacute
constexpr OStringLiteral tok_bar
constexpr OStringLiteral tok_dollar
constexpr OStringLiteral tok_n
constexpr OStringLiteral tok_oacute
constexpr OStringLiteral tok_parenright
constexpr OStringLiteral tok_multiply
constexpr OStringLiteral tok_comma
constexpr OStringLiteral tok_F
constexpr OStringLiteral tok_sixoldstyle
constexpr OStringLiteral tok_msuperior
static OString dbl2str(double fVal)
constexpr OStringLiteral tok_fiveinferior
constexpr OStringLiteral tok_oneinferior
constexpr OStringLiteral tok_m
constexpr OStringLiteral tok_daggerdbl
constexpr OStringLiteral tok_ampersandsmall
constexpr OStringLiteral tok_Dsmall
constexpr OStringLiteral tok_Thorn
constexpr OStringLiteral tok_Acircumflexsmall
constexpr OStringLiteral tok_Oslash
constexpr OStringLiteral tok_oneeight
constexpr OStringLiteral tok_Ecircumflex
constexpr OStringLiteral tok_lsuperior
constexpr OStringLiteral tok_dollarsuperior
constexpr OStringLiteral tok_Gsmall
constexpr OStringLiteral tok_atilde
constexpr OStringLiteral tok_Idieresis
constexpr OStringLiteral tok_dotlessi
constexpr OStringLiteral tok_eightinferior
constexpr OStringLiteral tok_Egrave
constexpr OStringLiteral tok_Ccedillasmall
constexpr OStringLiteral tok_fiveeights
constexpr OStringLiteral tok_Aacutesmall
constexpr OStringLiteral tok_a
constexpr OStringLiteral tok_r
constexpr OStringLiteral tok_aring
constexpr OStringLiteral tok_semicolon
constexpr OStringLiteral tok_Ydieresissmall
constexpr OStringLiteral tok_onesuperior
constexpr OStringLiteral tok_divide
constexpr OStringLiteral tok_quotesingle
constexpr OStringLiteral tok_y
constexpr OStringLiteral tok_guilsinglleft
constexpr OStringLiteral tok_colonmonetary
constexpr OStringLiteral tok_perthousand
constexpr OStringLiteral tok_guillemotright
constexpr OStringLiteral tok_bsuperior
constexpr OStringLiteral tok_fouroldstyle
constexpr OStringLiteral tok_slash
constexpr OStringLiteral tok_cedilla
constexpr OStringLiteral tok_E
constexpr OStringLiteral tok_onequarter
constexpr OStringLiteral tok_Circumflexsmall
constexpr OStringLiteral tok_periodcentered
constexpr OStringLiteral tok_g
constexpr OStringLiteral tok_Dieresissmall
constexpr OStringLiteral tok_hyphensuperior
constexpr OStringLiteral tok_K
constexpr OStringLiteral tok_Lslashsmall
constexpr OStringLiteral tok_ampersand
constexpr OStringLiteral tok_trademark
constexpr OStringLiteral tok_guilsinglright
constexpr OStringLiteral tok_fraction
constexpr OStringLiteral tok_Edieresissmall
constexpr OStringLiteral tok_Gravesmall
constexpr OStringLiteral tok_x
constexpr OStringLiteral tok_Zcaron
constexpr OStringLiteral tok_Atilde
constexpr OStringLiteral tok_Eacute
constexpr OStringLiteral tok_Lsmall
constexpr OStringLiteral tok_yen
constexpr OStringLiteral tok_questionsmall
constexpr OStringLiteral tok_question
constexpr OStringLiteral tok_five
constexpr OStringLiteral tok_Hsmall
constexpr OStringLiteral tok_Ocircumflex
constexpr OStringLiteral tok_c
constexpr OStringLiteral tok_Adieresis
constexpr OStringLiteral tok_twosuperior
constexpr OStringLiteral tok_threesuperior
constexpr OStringLiteral tok_V
constexpr OStringLiteral tok_caron
constexpr OStringLiteral tok_O
constexpr OStringLiteral tok_ffl
constexpr OStringLiteral tok_z
constexpr OStringLiteral tok_eth
constexpr OStringLiteral tok_sixsuperior
constexpr OStringLiteral tok_Iacute
constexpr OStringLiteral tok_Ogravesmall
constexpr OStringLiteral tok_ae
constexpr OStringLiteral tok_hypheninferior
constexpr OStringLiteral tok_Ugrave
constexpr OStringLiteral tok_less
constexpr OStringLiteral tok_Qsmall
constexpr OStringLiteral tok_nsuperior
constexpr OStringLiteral tok_eight
constexpr OStringLiteral tok_bullet
constexpr OStringLiteral tok_H
constexpr OStringLiteral tok_p
constexpr OStringLiteral tok_isuperior
constexpr OStringLiteral tok_Esmall
constexpr OStringLiteral tok_eightsuperior
constexpr OStringLiteral tok_Tildesmall
constexpr OStringLiteral tok_U
constexpr OStringLiteral tok_oneoldstyle
constexpr OStringLiteral tok_Ccedilla
constexpr OStringLiteral tok_Cedillasmall
constexpr OStringLiteral tok_Oacute
static rtl::OStringConstExpr pStringIds[]
constexpr OStringLiteral tok_f
constexpr OStringLiteral tok_G
constexpr OStringLiteral tok_P
constexpr OStringLiteral tok_bracketright
constexpr OStringLiteral tok_Wsmall
constexpr OStringLiteral tok_asuperior
constexpr OStringLiteral tok_seven
constexpr OStringLiteral tok_dollaroldstyle
constexpr OStringLiteral tok_Edieresis
constexpr OStringLiteral tok_fl
constexpr OStringLiteral tok_001_002
constexpr OStringLiteral tok_agrave
constexpr OStringLiteral tok_onefitted
constexpr OStringLiteral tok_greater
constexpr OStringLiteral tok_otilde
constexpr OStringLiteral tok_Aringsmall
constexpr OStringLiteral tok_Udieresissmall
constexpr OStringLiteral tok_ugrave
constexpr OStringLiteral tok_osuperior
constexpr OStringLiteral tok_o
constexpr OStringLiteral tok_figuredash
constexpr OStringLiteral tok_Egravesmall
constexpr OStringLiteral tok_sixinferior
constexpr OStringLiteral tok_icircumflex
constexpr OStringLiteral tok_Oacutesmall
constexpr OStringLiteral tok_Igrave
static const char * pDictEscs[]
constexpr OStringLiteral tok_Regular
constexpr OStringLiteral tok_braceright
constexpr OStringLiteral tok_twodotenleader
constexpr OStringLiteral tok_odieresis
constexpr OStringLiteral tok_v
constexpr OStringLiteral tok_001_000
constexpr OStringLiteral tok_minus
constexpr OStringLiteral tok_Eacutesmall
constexpr OStringLiteral tok_iacute
constexpr OStringLiteral tok_quotesinglbase
constexpr OStringLiteral tok_Xsmall
constexpr OStringLiteral tok_questiondownsmall
constexpr OStringLiteral tok_questiondown
constexpr OStringLiteral tok_plus
constexpr OStringLiteral tok_Odieressissmall
constexpr OStringLiteral tok_oe
constexpr OStringLiteral tok_eacute
constexpr OStringLiteral tok_Otildesmall
constexpr OStringLiteral tok_Acutesmall
constexpr OStringLiteral tok_asciitilde
constexpr OStringLiteral tok_Nsmall
constexpr OStringLiteral tok_acute
constexpr OStringLiteral tok_Z
constexpr OStringLiteral tok_w
constexpr OStringLiteral tok_I
constexpr OStringLiteral tok_Yacutesmall
constexpr OStringLiteral tok_nineinferior
constexpr OStringLiteral tok_foursuperior
constexpr OStringLiteral tok_asciicircum
constexpr OStringLiteral tok_AEsmall
constexpr OStringLiteral tok_equal
constexpr OStringLiteral tok_OE
constexpr OStringLiteral tok_ffi
constexpr OStringLiteral tok_Jsmall
constexpr OStringLiteral tok_Y
constexpr OStringLiteral tok_Dotaccentsmall
constexpr OStringLiteral tok_two
constexpr OStringLiteral tok_parenrightsuperior
constexpr OStringLiteral tok_Msmall
constexpr OStringLiteral tok_Bsmall
constexpr OStringLiteral tok_one
constexpr OStringLiteral tok_mu
constexpr OStringLiteral tok_circumflex
constexpr OStringLiteral tok_Fsmall
constexpr OStringLiteral tok_Bold
constexpr OStringLiteral tok_exclam
constexpr OStringLiteral tok_centoldstyle
constexpr OStringLiteral tok_guillemotleft
constexpr OStringLiteral tok_twooldstyle
constexpr OStringLiteral tok_adieresis
constexpr OStringLiteral tok_Uacutesmall
constexpr OStringLiteral tok_Caronsmall
constexpr OStringLiteral tok_underscore
constexpr OStringLiteral tok_Book
constexpr OStringLiteral tok_Rsmall
constexpr OStringLiteral tok_fi
constexpr OStringLiteral tok_threeinferior
constexpr OStringLiteral tok_Vsmall
constexpr OStringLiteral tok_ordmasculine
constexpr OStringLiteral tok_Tsmall
constexpr OStringLiteral tok_quoteright
constexpr OStringLiteral tok_idieresis
constexpr OStringLiteral tok_dotaccent
constexpr OStringLiteral tok_ntilde
constexpr OStringLiteral tok_oslash
constexpr OStringLiteral tok_Eth
constexpr OStringLiteral tok_dieresis
constexpr OStringLiteral tok_fiveoldstyle
constexpr OStringLiteral tok_nine
constexpr OStringLiteral tok_s
constexpr OStringLiteral tok_grave
constexpr OStringLiteral tok_Psmall
constexpr OStringLiteral tok_onedotenleader
constexpr OStringLiteral tok_Ucircumflex
constexpr OStringLiteral tok_Icircumflexsmall
constexpr OStringLiteral tok_seveneights
constexpr OStringLiteral tok_OEsmall
constexpr OStringLiteral tok_Atildesmall
constexpr OStringLiteral tok_Ethsmall
constexpr OStringLiteral tok_ordfeminine
constexpr OStringLiteral tok_asterisk
constexpr OStringLiteral tok_plusminus
constexpr OStringLiteral tok_Zsmall
constexpr OStringLiteral tok_Oslashsmall
constexpr OStringLiteral tok_emdash
constexpr OStringLiteral tok_threeeights
constexpr OStringLiteral tok_periodinferior
constexpr OStringLiteral tok_macron
constexpr OStringLiteral tok_zcaron
constexpr OStringLiteral tok_centsuperior
constexpr OStringLiteral tok_R
constexpr OStringLiteral tok_Scaronsmall
constexpr OStringLiteral tok_ogonek
constexpr OStringLiteral tok_quotedbl
constexpr OStringLiteral tok_zeroinferior
constexpr OStringLiteral tok_ocircumflex
constexpr OStringLiteral tok_ssuperior
constexpr OStringLiteral tok_zero
constexpr OStringLiteral tok_three
constexpr OStringLiteral tok_M
constexpr OStringLiteral tok_Light
constexpr OStringLiteral tok_Uacute
constexpr OStringLiteral tok_ydieresis
constexpr OStringLiteral tok_Aring
constexpr OStringLiteral tok_Iacutesmall
constexpr OStringLiteral tok_B
constexpr OStringLiteral tok_endash
constexpr OStringLiteral tok_exclamsmall
constexpr OStringLiteral tok_b
tools::Rectangle m_aFontBBox
const char * mpReqFontName
FontType m_nFontType
font-type of subset result
unsigned const char * mpInFontBytes
const sal_GlyphId * mpReqGlyphIds
bool CreateFontSubsetFromCff()
const sal_uInt8 * mpReqEncodedIds
FontType mnReqFontTypeMask
allowed subset-target font types
int m_nAscent
all metrics in PS font units
@ TYPE1_PFB
PSType1 Postscript Font Binary.
@ TYPE1_PFA
PSType1 Postscript Font Ascii.
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
#define SAL_N_ELEMENTS(arr)
OUString getString(const Any &_rAny)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
int sprintf(char(&s)[N], char const *format, T &&... arguments)
const wchar_t *typedef int(__stdcall *DllNativeUnregProc)(int