diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2016-11-24 00:53:05 +0200 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2016-11-26 08:26:35 +0000 |
commit | abe4d7bd0a1ec4b5a31cc5622080952e4cd53ebf (patch) | |
tree | c1eadca9f5d3e5256236c18501981f4276fac361 | |
parent | 47ea13ef8dc8ab9aeded6121845e3ebd1d28b292 (diff) |
Kill code for Type 1 fonts on Unix
We already ignore them, so this is unreachable code now.
Change-Id: I6fd4699d8175344c36253bf4bf9c024b8986da31
Reviewed-on: https://gerrit.libreoffice.org/31222
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
-rw-r--r-- | vcl/CustomTarget_afm_hash.mk | 20 | ||||
-rw-r--r-- | vcl/Library_vcl.mk | 3 | ||||
-rw-r--r-- | vcl/Module_vcl.mk | 1 | ||||
-rw-r--r-- | vcl/inc/unx/fontmanager.hxx | 65 | ||||
-rw-r--r-- | vcl/inc/unx/genpspgraphics.h | 3 | ||||
-rw-r--r-- | vcl/inc/unx/printergfx.hxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/fontmanager/adobe_encoding_table.hxx | 1078 | ||||
-rw-r--r-- | vcl/unx/generic/fontmanager/afm_keyword_list | 62 | ||||
-rw-r--r-- | vcl/unx/generic/fontmanager/fontcache.cxx | 42 | ||||
-rw-r--r-- | vcl/unx/generic/fontmanager/fontmanager.cxx | 672 | ||||
-rw-r--r-- | vcl/unx/generic/fontmanager/parseAFM.cxx | 1465 | ||||
-rw-r--r-- | vcl/unx/generic/fontmanager/parseAFM.hxx | 323 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/cairotextrender.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/generic/print/genpspgraphics.cxx | 49 | ||||
-rw-r--r-- | vcl/unx/generic/print/glyphset.cxx | 131 | ||||
-rw-r--r-- | vcl/unx/generic/print/glyphset.hxx | 5 | ||||
-rw-r--r-- | vcl/unx/generic/print/text_gfx.cxx | 73 |
17 files changed, 21 insertions, 3983 deletions
diff --git a/vcl/CustomTarget_afm_hash.mk b/vcl/CustomTarget_afm_hash.mk deleted file mode 100644 index bf88fb956761..000000000000 --- a/vcl/CustomTarget_afm_hash.mk +++ /dev/null @@ -1,20 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# - -$(eval $(call gb_CustomTarget_CustomTarget,vcl/unx/generic/fontmanager)) - -$(call gb_CustomTarget_get_target,vcl/unx/generic/fontmanager) : \ - $(call gb_CustomTarget_get_workdir,vcl/unx/generic/fontmanager)/afm_hash.hpp - -$(call gb_CustomTarget_get_workdir,vcl/unx/generic/fontmanager)/afm_hash.hpp : \ - $(SRCDIR)/vcl/unx/generic/fontmanager/afm_keyword_list \ - | $(call gb_CustomTarget_get_workdir,vcl/unx/generic/fontmanager)/.dir - $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),GPF,1) - $(GPERF) -C -t -l -L C++ -m 20 -Z AfmKeywordHash -k '1,4,6,$$' $< | sed -e 's/(char\*)0/(char\*)0, NOPE/g' | grep -v '^#line' > $@ - -# vim: set noet sw=4: diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 990ca11a5829..48870e4fa6cd 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -35,8 +35,6 @@ endif $(eval $(call gb_Library_set_precompiled_header,vcl,$(SRCDIR)/vcl/inc/pch/precompiled_vcl)) -$(eval $(call gb_Library_use_custom_headers,vcl,officecfg/registry vcl/unx/generic/fontmanager)) - $(eval $(call gb_Library_set_include,vcl,\ $$(INCLUDE) \ -I$(SRCDIR)/vcl/inc \ @@ -549,7 +547,6 @@ vcl_headless_freetype_code=\ vcl/unx/generic/fontmanager/fontconfig \ vcl/unx/generic/fontmanager/fontmanager \ vcl/unx/generic/fontmanager/helper \ - vcl/unx/generic/fontmanager/parseAFM \ vcl/headless/svpcairotextrender \ vcl/unx/generic/print/bitmap_gfx \ vcl/unx/generic/print/common_gfx \ diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 97e20f013f8e..767d5f74e05b 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -20,7 +20,6 @@ $(eval $(call gb_Module_Module,vcl)) $(eval $(call gb_Module_add_targets,vcl,\ - CustomTarget_afm_hash \ Library_vcl \ Package_opengl \ $(if $(filter WNT,$(OS)), \ diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx index 7f0e057addf7..46a951a29b28 100644 --- a/vcl/inc/unx/fontmanager.hxx +++ b/vcl/inc/unx/fontmanager.hxx @@ -57,7 +57,6 @@ namespace fonttype { enum type { Unknown = 0, - Type1 = 1, TrueType = 2, }; } @@ -65,8 +64,8 @@ enum type { /* * the difference between FastPrintFontInfo and PrintFontInfo * is that the information in FastPrintFontInfo can usually - * be gathered without opening either the font file or - * an afm metric file. they are gathered from fonts.dir alone. + * be gathered without opening either the font file, they are + * gathered from fonts.dir alone. * if only FastPrintFontInfo is gathered and PrintFontInfo * on demand and for less fonts, then performance in startup * increases considerably @@ -88,7 +87,6 @@ struct FastPrintFontInfo FontPitch m_ePitch; rtl_TextEncoding m_aEncoding; bool m_bSubsettable; - bool m_bEmbeddable; FastPrintFontInfo() : m_nID(0) @@ -100,7 +98,6 @@ struct FastPrintFontInfo , m_ePitch(PITCH_DONTKNOW) , m_aEncoding(RTL_TEXTENCODING_DONTKNOW) , m_bSubsettable(false) - , m_bEmbeddable(false) {} }; @@ -142,10 +139,8 @@ class VCL_PLUGIN_PUBLIC PrintFontManager { struct PrintFont; struct TrueTypeFontFile; - struct Type1FontFile; friend struct PrintFont; friend struct TrueTypeFontFile; - friend struct Type1FontFile; friend class FontCache; struct PrintFontMetrics @@ -188,7 +183,6 @@ class VCL_PLUGIN_PUBLIC PrintFontManager FontWeight m_eWeight; FontPitch m_ePitch; rtl_TextEncoding m_aEncoding; - bool m_bFontEncodingOnly; // set if font should be only accessed by builtin encoding CharacterMetric m_aGlobalMetricX; CharacterMetric m_aGlobalMetricY; PrintFontMetrics* m_pMetrics; @@ -202,33 +196,9 @@ class VCL_PLUGIN_PUBLIC PrintFontManager bool m_bHaveVerticalSubstitutedGlyphs; bool m_bUserOverride; - /// mapping from unicode (well, UCS-2) to font code - std::map< sal_Unicode, sal_Int32 > m_aEncodingVector; - /// HACK for Type 1 fonts: if multiple UCS-2 codes map to the same - /// font code, this set contains the preferred one, i.e., the one that - /// is specified explicitly via "C" or "CH" in the AFM file - std::set<sal_Unicode> m_aEncodingVectorPriority; - std::map< sal_Unicode, OString > m_aNonEncoded; - explicit PrintFont( fonttype::type eType ); virtual ~PrintFont(); virtual bool queryMetricPage( int nPage, utl::MultiAtomProvider* pProvider ) = 0; - - bool readAfmMetrics( utl::MultiAtomProvider* pProvider, bool bFillEncodingvector, bool bOnlyGlobalAttributes ); - }; - - struct Type1FontFile : public PrintFont - { - int m_nDirectory; // atom containing system dependent path - OString m_aFontFile; // relative to directory - OString m_aMetricFile; // dito - - /* note: m_aFontFile and Metric file are not atoms - because they should be fairly unique */ - - Type1FontFile() : PrintFont( fonttype::Type1 ), m_nDirectory( 0 ) {} - virtual ~Type1FontFile() override; - virtual bool queryMetricPage( int nPage, utl::MultiAtomProvider* pProvider ) override; }; struct TrueTypeFontFile : public PrintFont @@ -258,14 +228,8 @@ class VCL_PLUGIN_PUBLIC PrintFontManager std::unordered_map< int, OString > m_aAtomToDir; int m_nNextDirAtom; - std::unordered_multimap< OString, sal_Unicode, OStringHash > m_aAdobenameToUnicode; - std::unordered_multimap< sal_Unicode, OString > m_aUnicodeToAdobename; - std::unordered_multimap< sal_Unicode, sal_uInt8 > m_aUnicodeToAdobecode; - std::unordered_multimap< sal_uInt8, sal_Unicode > m_aAdobecodeToUnicode; - mutable FontCache* m_pFontCache; - OString getAfmFile( PrintFont* pFont ) const; OString getFontFile( PrintFont* pFont ) const; bool analyzeFontFile( int nDirID, const OString& rFileName, std::list< PrintFont* >& rNewFonts, const char *pFormat=nullptr ) const; @@ -375,13 +339,6 @@ public: return pFont ? pFont->m_aEncoding : RTL_TEXTENCODING_DONTKNOW; } - // should i only use font's builtin encoding ? - bool getUseOnlyFontEncoding( fontID nFontID ) const - { - PrintFont* pFont = getFont( nFontID ); - return pFont && pFont->m_bFontEncodingOnly; - } - // get a specific fonts system dependent filename OString getFontFileSysPath( fontID nFontID ) const { @@ -413,28 +370,10 @@ public: // the user is responsible to allocate pArray large enough bool getMetrics( fontID nFontID, const sal_Unicode* pString, int nLen, CharacterMetric* pArray ) const; - // get encoding vector of font, currently only for Type1 fonts - // returns NULL if encoding vector is empty or font is not type1; - // if ppNonEncoded is set and non encoded type1 glyphs exist - // then *ppNonEncoded is set to the mapping for nonencoded glyphs. - // the encoding vector contains -1 for non encoded glyphs - const std::map< sal_Unicode, sal_Int32 >* getEncodingMap( fontID nFontID, const std::map< sal_Unicode, OString >** ppNonEncoded, std::set<sal_Unicode> const ** ppPriority ) const; - // evaluates copyright flags for TrueType fonts for printing/viewing // type1 fonts do not have such a feature, so return for them is true bool isFontDownloadingAllowedForPrinting( fontID nFont ) const; - // helper for type 1 fonts - std::list< OString > getAdobeNameFromUnicode( sal_Unicode aChar ) const; - - std::vector< sal_Unicode > getUnicodeFromAdobeName( const OString& rName ) const; - std::pair< std::unordered_multimap< sal_uInt8, sal_Unicode >::const_iterator, - std::unordered_multimap< sal_uInt8, sal_Unicode >::const_iterator > - getUnicodeFromAdobeCode( sal_uInt8 aChar ) const - { - return m_aAdobecodeToUnicode.equal_range( aChar ); - } - // creates a new font subset of an existing TrueType font // returns true in case of success, else false // nFont: the font to be subsetted diff --git a/vcl/inc/unx/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h index 5d0acd4484f5..f4fe48629ef7 100644 --- a/vcl/inc/unx/genpspgraphics.h +++ b/vcl/inc/unx/genpspgraphics.h @@ -62,9 +62,6 @@ public: static void DoFreeEmbedFontData( const void* pData, long nLen ); // helper methods for sharing with X11SalGraphics - static const Ucs2SIntMap* DoGetFontEncodingVector( psp::fontID aFont, - const Ucs2OStrMap** pNonEncoded, - std::set<sal_Unicode> const** ppPriority); static void DoGetGlyphWidths( psp::fontID aFont, bool bVertical, std::vector< sal_Int32 >& rWidths, diff --git a/vcl/inc/unx/printergfx.hxx b/vcl/inc/unx/printergfx.hxx index c254ef6ace16..0b0512e65930 100644 --- a/vcl/inc/unx/printergfx.hxx +++ b/vcl/inc/unx/printergfx.hxx @@ -182,7 +182,6 @@ private: glyph in one of the subfonts, the mapping from unicode to the glyph has to be remembered */ - std::vector< sal_Int32 > maPS1Font; std::list< GlyphSet > maPS3Font; sal_Int32 mnFontID; @@ -233,7 +232,6 @@ public: void PSSetColor (const PrinterColor& rColor) { maVirtualStatus.maColor = rColor; } - void PSUploadPS1Font (sal_Int32 nFontID); void PSSetFont (const OString& rName, rtl_TextEncoding nEncoding) { maVirtualStatus.maFont = rName; maVirtualStatus.maEncoding = nEncoding; } diff --git a/vcl/unx/generic/fontmanager/adobe_encoding_table.hxx b/vcl/unx/generic/fontmanager/adobe_encoding_table.hxx deleted file mode 100644 index f2a7451f9c1a..000000000000 --- a/vcl/unx/generic/fontmanager/adobe_encoding_table.hxx +++ /dev/null @@ -1,1078 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -struct AdobeEncEntry { - sal_Unicode aUnicode; - sal_uInt8 aAdobeStandardCode; - const char* const pAdobename; -}; - -static const AdobeEncEntry aAdobeCodes[]= -{ - { 0x0041, 0101, "A" }, - { 0x00C6, 0341, "AE" }, - { 0x01FC, 0, "AEacute" }, - { 0xF7E6, 0, "AEsmall" }, - { 0x00C1, 0, "Aacute" }, - { 0xF7E1, 0, "Aacutesmall" }, - { 0x0102, 0, "Abreve" }, - { 0x00C2, 0, "Acircumflex" }, - { 0xF7E2, 0, "Acircumflexsmall" }, - { 0xF6C9, 0, "Acute" }, - { 0xF7B4, 0, "Acutesmall" }, - { 0x00C4, 0, "Adieresis" }, - { 0xF7E4, 0, "Adieresissmall" }, - { 0x00C0, 0, "Agrave" }, - { 0xF7E0, 0, "Agravesmall" }, - { 0x0391, 0, "Alpha" }, - { 0x0386, 0, "Alphatonos" }, - { 0x0100, 0, "Amacron" }, - { 0x0104, 0, "Aogonek" }, - { 0x00C5, 0, "Aring" }, - { 0x01FA, 0, "Aringacute" }, - { 0xF7E5, 0, "Aringsmall" }, - { 0xF761, 0, "Asmall" }, - { 0x00C3, 0, "Atilde" }, - { 0xF7E3, 0, "Atildesmall" }, - { 0x0042, 0102, "B" }, - { 0x0392, 0, "Beta" }, - { 0xF6F4, 0, "Brevesmall" }, - { 0xF762, 0, "Bsmall" }, - { 0x0043, 0103, "C" }, - { 0x0106, 0, "Cacute" }, - { 0xF6CA, 0, "Caron" }, - { 0xF6F5, 0, "Caronsmall" }, - { 0x010C, 0, "Ccaron" }, - { 0x00C7, 0, "Ccedilla" }, - { 0xF7E7, 0, "Ccedillasmall" }, - { 0x0108, 0, "Ccircumflex" }, - { 0x010A, 0, "Cdotaccent" }, - { 0xF7B8, 0, "Cedillasmall" }, - { 0x03A7, 0, "Chi" }, - { 0xF6F6, 0, "Circumflexsmall" }, - { 0xF763, 0, "Csmall" }, - { 0x0044, 0104, "D" }, - { 0x010E, 0, "Dcaron" }, - { 0x0110, 0, "Dcroat" }, - { 0x2206, 0, "Delta" }, - { 0x0394, 0, "Delta" }, - { 0xF6CB, 0, "Dieresis" }, - { 0xF6CC, 0, "DieresisAcute" }, - { 0xF6CD, 0, "DieresisGrave" }, - { 0xF7A8, 0, "Dieresissmall" }, - { 0xF6F7, 0, "Dotaccentsmall" }, - { 0xF764, 0, "Dsmall" }, - { 0x0045, 0105, "E" }, - { 0x00C9, 0, "Eacute" }, - { 0xF7E9, 0, "Eacutesmall" }, - { 0x0114, 0, "Ebreve" }, - { 0x011A, 0, "Ecaron" }, - { 0x00CA, 0, "Ecircumflex" }, - { 0xF7EA, 0, "Ecircumflexsmall" }, - { 0x00CB, 0, "Edieresis" }, - { 0xF7EB, 0, "Edieresissmall" }, - { 0x0116, 0, "Edotaccent" }, - { 0x00C8, 0, "Egrave" }, - { 0xF7E8, 0, "Egravesmall" }, - { 0x0112, 0, "Emacron" }, - { 0x014A, 0, "Eng" }, - { 0x0118, 0, "Eogonek" }, - { 0x0395, 0, "Epsilon" }, - { 0x0388, 0, "Epsilontonos" }, - { 0xF765, 0, "Esmall" }, - { 0x0397, 0, "Eta" }, - { 0x0389, 0, "Etatonos" }, - { 0x00D0, 0, "Eth" }, - { 0xF7F0, 0, "Ethsmall" }, - { 0x20AC, 0, "Euro" }, - { 0x0046, 0106, "F" }, - { 0xF766, 0, "Fsmall" }, - { 0x0047, 0107, "G" }, - { 0x0393, 0, "Gamma" }, - { 0x011E, 0, "Gbreve" }, - { 0x01E6, 0, "Gcaron" }, - { 0x011C, 0, "Gcircumflex" }, - { 0x0122, 0, "Gcommaaccent" }, - { 0x0120, 0, "Gdotaccent" }, - { 0xF6CE, 0, "Grave" }, - { 0xF760, 0, "Gravesmall" }, - { 0xF767, 0, "Gsmall" }, - { 0x0048, 0110, "H" }, - { 0x25CF, 0, "H18533" }, - { 0x25AA, 0, "H18543" }, - { 0x25AB, 0, "H18551" }, - { 0x25A1, 0, "H22073" }, - { 0x0126, 0, "Hbar" }, - { 0x0124, 0, "Hcircumflex" }, - { 0xF768, 0, "Hsmall" }, - { 0xF6CF, 0, "Hungarumlaut" }, - { 0xF6F8, 0, "Hungarumlautsmall" }, - { 0x0049, 0111, "I" }, - { 0x0132, 0, "IJ" }, - { 0x00CD, 0, "Iacute" }, - { 0xF7ED, 0, "Iacutesmall" }, - { 0x012C, 0, "Ibreve" }, - { 0x00CE, 0, "Icircumflex" }, - { 0xF7EE, 0, "Icircumflexsmall" }, - { 0x00CF, 0, "Idieresis" }, - { 0xF7EF, 0, "Idieresissmall" }, - { 0x0130, 0, "Idotaccent" }, - { 0x2111, 0, "Ifraktur" }, - { 0x00CC, 0, "Igrave" }, - { 0xF7EC, 0, "Igravesmall" }, - { 0x012A, 0, "Imacron" }, - { 0x012E, 0, "Iogonek" }, - { 0x0399, 0, "Iota" }, - { 0x03AA, 0, "Iotadieresis" }, - { 0x038A, 0, "Iotatonos" }, - { 0xF769, 0, "Ismall" }, - { 0x0128, 0, "Itilde" }, - { 0x004A, 0112, "J" }, - { 0x0134, 0, "Jcircumflex" }, - { 0xF76A, 0, "Jsmall" }, - { 0x004B, 0113, "K" }, - { 0x039A, 0, "Kappa" }, - { 0x0136, 0, "Kcommaaccent" }, - { 0xF76B, 0, "Ksmall" }, - { 0x004C, 0114, "L" }, - { 0xF6BF, 0, "LL" }, - { 0x0139, 0, "Lacute" }, - { 0x039B, 0, "Lambda" }, - { 0x013D, 0, "Lcaron" }, - { 0x013B, 0, "Lcommaaccent" }, - { 0x013F, 0, "Ldot" }, - { 0x0141, 0350, "Lslash" }, - { 0xF6F9, 0, "Lslashsmall" }, - { 0xF76C, 0, "Lsmall" }, - { 0x004D, 0115, "M" }, - { 0xF6D0, 0, "Macron" }, - { 0xF7AF, 0, "Macronsmall" }, - { 0xF76D, 0, "Msmall" }, - { 0x039C, 0, "Mu" }, - { 0x004E, 0116, "N" }, - { 0x0143, 0, "Nacute" }, - { 0x0147, 0, "Ncaron" }, - { 0x0145, 0, "Ncommaaccent" }, - { 0xF76E, 0, "Nsmall" }, - { 0x00D1, 0, "Ntilde" }, - { 0xF7F1, 0, "Ntildesmall" }, - { 0x039D, 0, "Nu" }, - { 0x004F, 0117, "O" }, - { 0x0152, 0, "OE" }, - { 0xF6FA, 0, "OEsmall" }, - { 0x00D3, 0, "Oacute" }, - { 0xF7F3, 0, "Oacutesmall" }, - { 0x014E, 0, "Obreve" }, - { 0x00D4, 0, "Ocircumflex" }, - { 0xF7F4, 0, "Ocircumflexsmall" }, - { 0x00D6, 0, "Odieresis" }, - { 0xF7F6, 0, "Odieresissmall" }, - { 0xF6FB, 0, "Ogoneksmall" }, - { 0x00D2, 0, "Ograve" }, - { 0xF7F2, 0, "Ogravesmall" }, - { 0x01A0, 0, "Ohorn" }, - { 0x0150, 0, "Ohungarumlaut" }, - { 0x014C, 0, "Omacron" }, - { 0x2126, 0, "Omega" }, - { 0x03A9, 0, "Omega" }, - { 0x038F, 0, "Omegatonos" }, - { 0x039F, 0, "Omicron" }, - { 0x038C, 0, "Omicrontonos" }, - { 0x00D8, 0351, "Oslash" }, - { 0x01FE, 0, "Oslashacute" }, - { 0xF7F8, 0, "Oslashsmall" }, - { 0xF76F, 0, "Osmall" }, - { 0x00D5, 0, "Otilde" }, - { 0xF7F5, 0, "Otildesmall" }, - { 0x0050, 0120, "P" }, - { 0x03A6, 0, "Phi" }, - { 0x03A0, 0, "Pi" }, - { 0x03A8, 0, "Psi" }, - { 0xF770, 0, "Psmall" }, - { 0x0051, 0121, "Q" }, - { 0xF771, 0, "Qsmall" }, - { 0x0052, 0122, "R" }, - { 0x0154, 0, "Racute" }, - { 0x0158, 0, "Rcaron" }, - { 0x0156, 0, "Rcommaaccent" }, - { 0x211C, 0, "Rfraktur" }, - { 0x03A1, 0, "Rho" }, - { 0xF6FC, 0, "Ringsmall" }, - { 0xF772, 0, "Rsmall" }, - { 0x0053, 0123, "S" }, - { 0x250C, 0, "SF010000" }, - { 0x2514, 0, "SF020000" }, - { 0x2510, 0, "SF030000" }, - { 0x2518, 0, "SF040000" }, - { 0x253C, 0, "SF050000" }, - { 0x252C, 0, "SF060000" }, - { 0x2534, 0, "SF070000" }, - { 0x251C, 0, "SF080000" }, - { 0x2524, 0, "SF090000" }, - { 0x2500, 0, "SF100000" }, - { 0x2502, 0, "SF110000" }, - { 0x2561, 0, "SF190000" }, - { 0x2562, 0, "SF200000" }, - { 0x2556, 0, "SF210000" }, - { 0x2555, 0, "SF220000" }, - { 0x2563, 0, "SF230000" }, - { 0x2551, 0, "SF240000" }, - { 0x2557, 0, "SF250000" }, - { 0x255D, 0, "SF260000" }, - { 0x255C, 0, "SF270000" }, - { 0x255B, 0, "SF280000" }, - { 0x255E, 0, "SF360000" }, - { 0x255F, 0, "SF370000" }, - { 0x255A, 0, "SF380000" }, - { 0x2554, 0, "SF390000" }, - { 0x2569, 0, "SF400000" }, - { 0x2566, 0, "SF410000" }, - { 0x2560, 0, "SF420000" }, - { 0x2550, 0, "SF430000" }, - { 0x256C, 0, "SF440000" }, - { 0x2567, 0, "SF450000" }, - { 0x2568, 0, "SF460000" }, - { 0x2564, 0, "SF470000" }, - { 0x2565, 0, "SF480000" }, - { 0x2559, 0, "SF490000" }, - { 0x2558, 0, "SF500000" }, - { 0x2552, 0, "SF510000" }, - { 0x2553, 0, "SF520000" }, - { 0x256B, 0, "SF530000" }, - { 0x256A, 0, "SF540000" }, - { 0x015A, 0, "Sacute" }, - { 0x0160, 0, "Scaron" }, - { 0xF6FD, 0, "Scaronsmall" }, - { 0x015E, 0, "Scedilla" }, - { 0xF6C1, 0, "Scedilla" }, - { 0x015C, 0, "Scircumflex" }, - { 0x0218, 0, "Scommaaccent" }, - { 0x03A3, 0, "Sigma" }, - { 0xF773, 0, "Ssmall" }, - { 0x0054, 0124, "T" }, - { 0x03A4, 0, "Tau" }, - { 0x0166, 0, "Tbar" }, - { 0x0164, 0, "Tcaron" }, - { 0x0162, 0, "Tcommaaccent" }, - { 0x021A, 0, "Tcommaaccent" }, - { 0x0398, 0, "Theta" }, - { 0x00DE, 0, "Thorn" }, - { 0xF7FE, 0, "Thornsmall" }, - { 0xF6FE, 0, "Tildesmall" }, - { 0xF774, 0, "Tsmall" }, - { 0x0055, 0125, "U" }, - { 0x00DA, 0, "Uacute" }, - { 0xF7FA, 0, "Uacutesmall" }, - { 0x016C, 0, "Ubreve" }, - { 0x00DB, 0, "Ucircumflex" }, - { 0xF7FB, 0, "Ucircumflexsmall" }, - { 0x00DC, 0, "Udieresis" }, - { 0xF7FC, 0, "Udieresissmall" }, - { 0x00D9, 0, "Ugrave" }, - { 0xF7F9, 0, "Ugravesmall" }, - { 0x01AF, 0, "Uhorn" }, - { 0x0170, 0, "Uhungarumlaut" }, - { 0x016A, 0, "Umacron" }, - { 0x0172, 0, "Uogonek" }, - { 0x03A5, 0, "Upsilon" }, - { 0x03D2, 0, "Upsilon1" }, - { 0x03AB, 0, "Upsilondieresis" }, - { 0x038E, 0, "Upsilontonos" }, - { 0x016E, 0, "Uring" }, - { 0xF775, 0, "Usmall" }, - { 0x0168, 0, "Utilde" }, - { 0x0056, 0126, "V" }, - { 0xF776, 0, "Vsmall" }, - { 0x0057, 0127, "W" }, - { 0x1E82, 0, "Wacute" }, - { 0x0174, 0, "Wcircumflex" }, - { 0x1E84, 0, "Wdieresis" }, - { 0x1E80, 0, "Wgrave" }, - { 0xF777, 0, "Wsmall" }, - { 0x0058, 0130, "X" }, - { 0x039E, 0, "Xi" }, - { 0xF778, 0, "Xsmall" }, - { 0x0059, 0131, "Y" }, - { 0x00DD, 0, "Yacute" }, - { 0xF7FD, 0, "Yacutesmall" }, - { 0x0176, 0, "Ycircumflex" }, - { 0x0178, 0, "Ydieresis" }, - { 0xF7FF, 0, "Ydieresissmall" }, - { 0x1EF2, 0, "Ygrave" }, - { 0xF779, 0, "Ysmall" }, - { 0x005A, 0132, "Z" }, - { 0x0179, 0, "Zacute" }, - { 0x017D, 0, "Zcaron" }, - { 0xF6FF, 0, "Zcaronsmall" }, - { 0x017B, 0, "Zdotaccent" }, - { 0x0396, 0, "Zeta" }, - { 0xF77A, 0, "Zsmall" }, - { 0x0061, 0141, "a" }, - { 0x00E1, 0, "aacute" }, - { 0x0103, 0, "abreve" }, - { 0x00E2, 0, "acircumflex" }, - { 0x00B4, 0302, "acute" }, - { 0x0301, 0, "acutecomb" }, - { 0x00E4, 0, "adieresis" }, - { 0x00E6, 0361, "ae" }, - { 0x01FD, 0, "aeacute" }, - { 0x2015, 0, "afii00208" }, - { 0x0410, 0, "afii10017" }, - { 0x0411, 0, "afii10018" }, - { 0x0412, 0, "afii10019" }, - { 0x0413, 0, "afii10020" }, - { 0x0414, 0, "afii10021" }, - { 0x0415, 0, "afii10022" }, - { 0x0401, 0, "afii10023" }, - { 0x0416, 0, "afii10024" }, - { 0x0417, 0, "afii10025" }, - { 0x0418, 0, "afii10026" }, - { 0x0419, 0, "afii10027" }, - { 0x041A, 0, "afii10028" }, - { 0x041B, 0, "afii10029" }, - { 0x041C, 0, "afii10030" }, - { 0x041D, 0, "afii10031" }, - { 0x041E, 0, "afii10032" }, - { 0x041F, 0, "afii10033" }, - { 0x0420, 0, "afii10034" }, - { 0x0421, 0, "afii10035" }, - { 0x0422, 0, "afii10036" }, - { 0x0423, 0, "afii10037" }, - { 0x0424, 0, "afii10038" }, - { 0x0425, 0, "afii10039" }, - { 0x0426, 0, "afii10040" }, - { 0x0427, 0, "afii10041" }, - { 0x0428, 0, "afii10042" }, - { 0x0429, 0, "afii10043" }, - { 0x042A, 0, "afii10044" }, - { 0x042B, 0, "afii10045" }, - { 0x042C, 0, "afii10046" }, - { 0x042D, 0, "afii10047" }, - { 0x042E, 0, "afii10048" }, - { 0x042F, 0, "afii10049" }, - { 0x0490, 0, "afii10050" }, - { 0x0402, 0, "afii10051" }, - { 0x0403, 0, "afii10052" }, - { 0x0404, 0, "afii10053" }, - { 0x0405, 0, "afii10054" }, - { 0x0406, 0, "afii10055" }, - { 0x0407, 0, "afii10056" }, - { 0x0408, 0, "afii10057" }, - { 0x0409, 0, "afii10058" }, - { 0x040A, 0, "afii10059" }, - { 0x040B, 0, "afii10060" }, - { 0x040C, 0, "afii10061" }, - { 0x040E, 0, "afii10062" }, - { 0xF6C4, 0, "afii10063" }, - { 0xF6C5, 0, "afii10064" }, - { 0x0430, 0, "afii10065" }, - { 0x0431, 0, "afii10066" }, - { 0x0432, 0, "afii10067" }, - { 0x0433, 0, "afii10068" }, - { 0x0434, 0, "afii10069" }, - { 0x0435, 0, "afii10070" }, - { 0x0451, 0, "afii10071" }, - { 0x0436, 0, "afii10072" }, - { 0x0437, 0, "afii10073" }, - { 0x0438, 0, "afii10074" }, - { 0x0439, 0, "afii10075" }, - { 0x043A, 0, "afii10076" }, - { 0x043B, 0, "afii10077" }, - { 0x043C, 0, "afii10078" }, - { 0x043D, 0, "afii10079" }, - { 0x043E, 0, "afii10080" }, - { 0x043F, 0, "afii10081" }, - { 0x0440, 0, "afii10082" }, - { 0x0441, 0, "afii10083" }, - { 0x0442, 0, "afii10084" }, - { 0x0443, 0, "afii10085" }, - { 0x0444, 0, "afii10086" }, - { 0x0445, 0, "afii10087" }, - { 0x0446, 0, "afii10088" }, - { 0x0447, 0, "afii10089" }, - { 0x0448, 0, "afii10090" }, - { 0x0449, 0, "afii10091" }, - { 0x044A, 0, "afii10092" }, - { 0x044B, 0, "afii10093" }, - { 0x044C, 0, "afii10094" }, - { 0x044D, 0, "afii10095" }, - { 0x044E, 0, "afii10096" }, - { 0x044F, 0, "afii10097" }, - { 0x0491, 0, "afii10098" }, - { 0x0452, 0, "afii10099" }, - { 0x0453, 0, "afii10100" }, - { 0x0454, 0, "afii10101" }, - { 0x0455, 0, "afii10102" }, - { 0x0456, 0, "afii10103" }, - { 0x0457, 0, "afii10104" }, - { 0x0458, 0, "afii10105" }, - { 0x0459, 0, "afii10106" }, - { 0x045A, 0, "afii10107" }, - { 0x045B, 0, "afii10108" }, - { 0x045C, 0, "afii10109" }, - { 0x045E, 0, "afii10110" }, - { 0x040F, 0, "afii10145" }, - { 0x0462, 0, "afii10146" }, - { 0x0472, 0, "afii10147" }, - { 0x0474, 0, "afii10148" }, - { 0xF6C6, 0, "afii10192" }, - { 0x045F, 0, "afii10193" }, - { 0x0463, 0, "afii10194" }, - { 0x0473, 0, "afii10195" }, - { 0x0475, 0, "afii10196" }, - { 0xF6C7, 0, "afii10831" }, - { 0xF6C8, 0, "afii10832" }, - { 0x04D9, 0, "afii10846" }, - { 0x200E, 0, "afii299" }, - { 0x200F, 0, "afii300" }, - { 0x200D, 0, "afii301" }, - { 0x066A, 0, "afii57381" }, - { 0x060C, 0, "afii57388" }, - { 0x0660, 0, "afii57392" }, - { 0x0661, 0, "afii57393" }, - { 0x0662, 0, "afii57394" }, - { 0x0663, 0, "afii57395" }, - { 0x0664, 0, "afii57396" }, - { 0x0665, 0, "afii57397" }, - { 0x0666, 0, "afii57398" }, - { 0x0667, 0, "afii57399" }, - { 0x0668, 0, "afii57400" }, - { 0x0669, 0, "afii57401" }, - { 0x061B, 0, "afii57403" }, - { 0x061F, 0, "afii57407" }, - { 0x0621, 0, "afii57409" }, - { 0x0622, 0, "afii57410" }, - { 0x0623, 0, "afii57411" }, - { 0x0624, 0, "afii57412" }, - { 0x0625, 0, "afii57413" }, - { 0x0626, 0, "afii57414" }, - { 0x0627, 0, "afii57415" }, - { 0x0628, 0, "afii57416" }, - { 0x0629, 0, "afii57417" }, - { 0x062A, 0, "afii57418" }, - { 0x062B, 0, "afii57419" }, - { 0x062C, 0, "afii57420" }, - { 0x062D, 0, "afii57421" }, - { 0x062E, 0, "afii57422" }, - { 0x062F, 0, "afii57423" }, - { 0x0630, 0, "afii57424" }, - { 0x0631, 0, "afii57425" }, - { 0x0632, 0, "afii57426" }, - { 0x0633, 0, "afii57427" }, - { 0x0634, 0, "afii57428" }, - { 0x0635, 0, "afii57429" }, - { 0x0636, 0, "afii57430" }, - { 0x0637, 0, "afii57431" }, - { 0x0638, 0, "afii57432" }, - { 0x0639, 0, "afii57433" }, - { 0x063A, 0, "afii57434" }, - { 0x0640, 0, "afii57440" }, - { 0x0641, 0, "afii57441" }, - { 0x0642, 0, "afii57442" }, - { 0x0643, 0, "afii57443" }, - { 0x0644, 0, "afii57444" }, - { 0x0645, 0, "afii57445" }, - { 0x0646, 0, "afii57446" }, - { 0x0648, 0, "afii57448" }, - { 0x0649, 0, "afii57449" }, - { 0x064A, 0, "afii57450" }, - { 0x064B, 0, "afii57451" }, - { 0x064C, 0, "afii57452" }, - { 0x064D, 0, "afii57453" }, - { 0x064E, 0, "afii57454" }, - { 0x064F, 0, "afii57455" }, - { 0x0650, 0, "afii57456" }, - { 0x0651, 0, "afii57457" }, - { 0x0652, 0, "afii57458" }, - { 0x0647, 0, "afii57470" }, - { 0x06A4, 0, "afii57505" }, - { 0x067E, 0, "afii57506" }, - { 0x0686, 0, "afii57507" }, - { 0x0698, 0, "afii57508" }, - { 0x06AF, 0, "afii57509" }, - { 0x0679, 0, "afii57511" }, - { 0x0688, 0, "afii57512" }, - { 0x0691, 0, "afii57513" }, - { 0x06BA, 0, "afii57514" }, - { 0x06D2, 0, "afii57519" }, - { 0x06D5, 0, "afii57534" }, - { 0x20AA, 0, "afii57636" }, - { 0x05BE, 0, "afii57645" }, - { 0x05C3, 0, "afii57658" }, - { 0x05D0, 0, "afii57664" }, - { 0x05D1, 0, "afii57665" }, - { 0x05D2, 0, "afii57666" }, - { 0x05D3, 0, "afii57667" }, - { 0x05D4, 0, "afii57668" }, - { 0x05D5, 0, "afii57669" }, - { 0x05D6, 0, "afii57670" }, - { 0x05D7, 0, "afii57671" }, - { 0x05D8, 0, "afii57672" }, - { 0x05D9, 0, "afii57673" }, - { 0x05DA, 0, "afii57674" }, - { 0x05DB, 0, "afii57675" }, - { 0x05DC, 0, "afii57676" }, - { 0x05DD, 0, "afii57677" }, - { 0x05DE, 0, "afii57678" }, - { 0x05DF, 0, "afii57679" }, - { 0x05E0, 0, "afii57680" }, - { 0x05E1, 0, "afii57681" }, - { 0x05E2, 0, "afii57682" }, - { 0x05E3, 0, "afii57683" }, - { 0x05E4, 0, "afii57684" }, - { 0x05E5, 0, "afii57685" }, - { 0x05E6, 0, "afii57686" }, - { 0x05E7, 0, "afii57687" }, - { 0x05E8, 0, "afii57688" }, - { 0x05E9, 0, "afii57689" }, - { 0x05EA, 0, "afii57690" }, - { 0xFB2A, 0, "afii57694" }, - { 0xFB2B, 0, "afii57695" }, - { 0xFB4B, 0, "afii57700" }, - { 0xFB1F, 0, "afii57705" }, - { 0x05F0, 0, "afii57716" }, - { 0x05F1, 0, "afii57717" }, - { 0x05F2, 0, "afii57718" }, - { 0xFB35, 0, "afii57723" }, - { 0x05B4, 0, "afii57793" }, - { 0x05B5, 0, "afii57794" }, - { 0x05B6, 0, "afii57795" }, - { 0x05BB, 0, "afii57796" }, - { 0x05B8, 0, "afii57797" }, - { 0x05B7, 0, "afii57798" }, - { 0x05B0, 0, "afii57799" }, - { 0x05B2, 0, "afii57800" }, - { 0x05B1, 0, "afii57801" }, - { 0x05B3, 0, "afii57802" }, - { 0x05C2, 0, "afii57803" }, - { 0x05C1, 0, "afii57804" }, - { 0x05B9, 0, "afii57806" }, - { 0x05BC, 0, "afii57807" }, - { 0x05BD, 0, "afii57839" }, - { 0x05BF, 0, "afii57841" }, - { 0x05C0, 0, "afii57842" }, - { 0x02BC, 0, "afii57929" }, - { 0x2105, 0, "afii61248" }, - { 0x2113, 0, "afii61289" }, - { 0x2116, 0, "afii61352" }, - { 0x202C, 0, "afii61573" }, - { 0x202D, 0, "afii61574" }, - { 0x202E, 0, "afii61575" }, - { 0x200C, 0, "afii61664" }, - { 0x066D, 0, "afii63167" }, - { 0x02BD, 0, "afii64937" }, - { 0x00E0, 0, "agrave" }, - { 0x2135, 0, "aleph" }, - { 0x03B1, 0, "alpha" }, - { 0x03AC, 0, "alphatonos" }, - { 0x0101, 0, "amacron" }, - { 0x0026, 046, "ampersand" }, - { 0xF726, 0, "ampersandsmall" }, - { 0x2220, 0, "angle" }, - { 0x2329, 0, "angleleft" }, - { 0x232A, 0, "angleright" }, - { 0x0387, 0, "anoteleia" }, - { 0x0105, 0, "aogonek" }, - { 0x2248, 0, "approxequal" }, - { 0x00E5, 0, "aring" }, - { 0x01FB, 0, "aringacute" }, - { 0x2194, 0, "arrowboth" }, - { 0x21D4, 0, "arrowdblboth" }, - { 0x21D3, 0, "arrowdbldown" }, - { 0x21D0, 0, "arrowdblleft" }, - { 0x21D2, 0, "arrowdblright" }, - { 0x21D1, 0, "arrowdblup" }, - { 0x2193, 0, "arrowdown" }, - { 0xF8E7, 0, "arrowhorizex" }, - { 0x2190, 0, "arrowleft" }, - { 0x2192, 0, "arrowright" }, - { 0x2191, 0, "arrowup" }, - { 0x2195, 0, "arrowupdn" }, - { 0x21A8, 0, "arrowupdnbse" }, - { 0xF8E6, 0, "arrowvertex" }, - { 0x005E, 0136, "asciicircum" }, - { 0x007E, 0176, "asciitilde" }, - { 0x002A, 052, "asterisk" }, - { 0x2217, 0, "asteriskmath" }, - { 0xF6E9, 0, "asuperior" }, - { 0x0040, 0100, "at" }, - { 0x00E3, 0, "atilde" }, - { 0x0062, 0142, "b" }, - { 0x005C, 0134, "backslash" }, - { 0x007C, 0174, "bar" }, - { 0x03B2, 0, "beta" }, - { 0x2588, 0, "block" }, - { 0xF8F4, 0, "braceex" }, - { 0x007B, 0173, "braceleft" }, - { 0xF8F3, 0, "braceleftbt" }, - { 0xF8F2, 0, "braceleftmid" }, - { 0xF8F1, 0, "bracelefttp" }, - { 0x007D, 0175, "braceright" }, - { 0xF8FE, 0, "bracerightbt" }, - { 0xF8FD, 0, "bracerightmid" }, - { 0xF8FC, 0, "bracerighttp" }, - { 0x005B, 0133, "bracketleft" }, - { 0xF8F0, 0, "bracketleftbt" }, - { 0xF8EF, 0, "bracketleftex" }, - { 0xF8EE, 0, "bracketlefttp" }, - { 0x005D, 0135, "bracketright" }, - { 0xF8FB, 0, "bracketrightbt" }, - { 0xF8FA, 0, "bracketrightex" }, - { 0xF8F9, 0, "bracketrighttp" }, - { 0x02D8, 0306, "breve" }, - { 0x00A6, 0, "brokenbar" }, - { 0xF6EA, 0, "bsuperior" }, - { 0x2022, 0267, "bullet" }, - { 0x0063, 0143, "c" }, - { 0x0107, 0, "cacute" }, - { 0x02C7, 0317, "caron" }, - { 0x21B5, 0, "carriagereturn" }, - { 0x010D, 0, "ccaron" }, - { 0x00E7, 0, "ccedilla" }, - { 0x0109, 0, "ccircumflex" }, - { 0x010B, 0, "cdotaccent" }, - { 0x00B8, 0313, "cedilla" }, - { 0x00A2, 0242, "cent" }, - { 0xF6DF, 0, "centinferior" }, - { 0xF7A2, 0, "centoldstyle" }, - { 0xF6E0, 0, "centsuperior" }, - { 0x03C7, 0, "chi" }, - { 0x25CB, 0, "circle" }, - { 0x2297, 0, "circlemultiply" }, - { 0x2295, 0, "circleplus" }, - { 0x02C6, 0303, "circumflex" }, - { 0x2663, 0, "club" }, - { 0x003A, 072, "colon" }, - { 0x20A1, 0, "colonmonetary" }, - { 0x002C, 054, "comma" }, - { 0xF6C3, 0, "commaaccent" }, - { 0xF6E1, 0, "commainferior" }, - { 0xF6E2, 0, "commasuperior" }, - { 0x2245, 0, "congruent" }, - { 0x00A9, 0, "copyright" }, - { 0xF8E9, 0, "copyrightsans" }, - { 0xF6D9, 0, "copyrightserif" }, - { 0x00A4, 0250, "currency" }, - { 0xF6D1, 0, "cyrBreve" }, - { 0xF6D2, 0, "cyrFlex" }, - { 0xF6D4, 0, "cyrbreve" }, - { 0xF6D5, 0, "cyrflex" }, - { 0x0064, 0144, "d" }, - { 0x2020, 0262, "dagger" }, - { 0x2021, 0263, "daggerdbl" }, - { 0xF6D3, 0, "dblGrave" }, - { 0xF6D6, 0, "dblgrave" }, - { 0x010F, 0, "dcaron" }, - { 0x0111, 0, "dcroat" }, - { 0x00B0, 0, "degree" }, - { 0x03B4, 0, "delta" }, - { 0x2666, 0, "diamond" }, - { 0x00A8, 0310, "dieresis" }, - { 0xF6D7, 0, "dieresisacute" }, - { 0xF6D8, 0, "dieresisgrave" }, - { 0x0385, 0, "dieresistonos" }, - { 0x00F7, 0, "divide" }, - { 0x2593, 0, "dkshade" }, - { 0x2584, 0, "dnblock" }, - { 0x0024, 044, "dollar" }, - { 0xF6E3, 0, "dollarinferior" }, - { 0xF724, 0, "dollaroldstyle" }, - { 0xF6E4, 0, "dollarsuperior" }, - { 0x20AB, 0, "dong" }, - { 0x02D9, 0307, "dotaccent" }, - { 0x0323, 0, "dotbelowcomb" }, - { 0x0131, 0365, "dotlessi" }, - { 0xF6BE, 0, "dotlessj" }, - { 0x22C5, 0, "dotmath" }, - { 0xF6EB, 0, "dsuperior" }, - { 0x0065, 0145, "e" }, - { 0x00E9, 0, "eacute" }, - { 0x0115, 0, "ebreve" }, - { 0x011B, 0, "ecaron" }, - { 0x00EA, 0, "ecircumflex" }, - { 0x00EB, 0, "edieresis" }, - { 0x0117, 0, "edotaccent" }, - { 0x00E8, 0, "egrave" }, - { 0x0038, 070, "eight" }, - { 0x2088, 0, "eightinferior" }, - { 0xF738, 0, "eightoldstyle" }, - { 0x2078, 0, "eightsuperior" }, - { 0x2208, 0, "element" }, - { 0x2026, 0274, "ellipsis" }, - { 0x0113, 0, "emacron" }, - { 0x2014, 0320, "emdash" }, - { 0x2205, 0, "emptyset" }, - { 0x2013, 0261, "endash" }, - { 0x014B, 0, "eng" }, - { 0x0119, 0, "eogonek" }, - { 0x03B5, 0, "epsilon" }, - { 0x03AD, 0, "epsilontonos" }, - { 0x003D, 075, "equal" }, - { 0x2261, 0, "equivalence" }, - { 0x212E, 0, "estimated" }, - { 0xF6EC, 0, "esuperior" }, - { 0x03B7, 0, "eta" }, - { 0x03AE, 0, "etatonos" }, - { 0x00F0, 0, "eth" }, - { 0x0021, 041, "exclam" }, - { 0x203C, 0, "exclamdbl" }, - { 0x00A1, 0241, "exclamdown" }, - { 0xF7A1, 0, "exclamdownsmall" }, - { 0xF721, 0, "exclamsmall" }, - { 0x2203, 0, "existential" }, - { 0x0066, 0146, "f" }, - { 0x2640, 0, "female" }, - { 0xFB00, 0, "ff" }, - { 0xFB03, 0, "ffi" }, - { 0xFB04, 0, "ffl" }, - { 0xFB01, 0256, "fi" }, - { 0x2012, 0, "figuredash" }, - { 0x25A0, 0, "filledbox" }, - { 0x25AC, 0, "filledrect" }, - { 0x0035, 065, "five" }, - { 0x215D, 0, "fiveeighths" }, - { 0x2085, 0, "fiveinferior" }, - { 0xF735, 0, "fiveoldstyle" }, - { 0x2075, 0, "fivesuperior" }, - { 0xFB02, 0257, "fl" }, - { 0x0192, 0246, "florin" }, - { 0x0034, 064, "four" }, - { 0x2084, 0, "fourinferior" }, - { 0xF734, 0, "fouroldstyle" }, - { 0x2074, 0, "foursuperior" }, - { 0x2044, 0244, "fraction" }, - { 0x2215, 0244, "fraction" }, - { 0x20A3, 0, "franc" }, - { 0x0067, 0147, "g" }, - { 0x03B3, 0, "gamma" }, - { 0x011F, 0, "gbreve" }, - { 0x01E7, 0, "gcaron" }, - { 0x011D, 0, "gcircumflex" }, - { 0x0123, 0, "gcommaaccent" }, - { 0x0121, 0, "gdotaccent" }, - { 0x00DF, 0373, "germandbls" }, - { 0x2207, 0, "gradient" }, - { 0x0060, 0301, "grave" }, - { 0x0300, 0, "gravecomb" }, - { 0x003E, 076, "greater" }, - { 0x2265, 0, "greaterequal" }, - { 0x00AB, 0253, "guillemotleft" }, - { 0x00BB, 0273, "guillemotright" }, - { 0x2039, 0254, "guilsinglleft" }, - { 0x203A, 0255, "guilsinglright" }, - { 0x0068, 0150, "h" }, - { 0x0127, 0, "hbar" }, - { 0x0125, 0, "hcircumflex" }, - { 0x2665, 0, "heart" }, - { 0x0309, 0, "hookabovecomb" }, - { 0x2302, 0, "house" }, - { 0x02DD, 0315, "hungarumlaut" }, - { 0x002D, 055, "hyphen" }, - { 0x00AD, 0, "hyphen" }, - { 0xF6E5, 0, "hypheninferior" }, - { 0xF6E6, 0, "hyphensuperior" }, - { 0x0069, 0151, "i" }, - { 0x00ED, 0, "iacute" }, - { 0x012D, 0, "ibreve" }, - { 0x00EE, 0, "icircumflex" }, - { 0x00EF, 0, "idieresis" }, - { 0x00EC, 0, "igrave" }, - { 0x0133, 0, "ij" }, - { 0x012B, 0, "imacron" }, - { 0x221E, 0, "infinity" }, - { 0x222B, 0, "integral" }, - { 0x2321, 0, "integralbt" }, - { 0xF8F5, 0, "integralex" }, - { 0x2320, 0, "integraltp" }, - { 0x2229, 0, "intersection" }, - { 0x25D8, 0, "invbullet" }, - { 0x25D9, 0, "invcircle" }, - { 0x263B, 0, "invsmileface" }, - { 0x012F, 0, "iogonek" }, - { 0x03B9, 0, "iota" }, - { 0x03CA, 0, "iotadieresis" }, - { 0x0390, 0, "iotadieresistonos" }, - { 0x03AF, 0, "iotatonos" }, - { 0xF6ED, 0, "isuperior" }, - { 0x0129, 0, "itilde" }, - { 0x006A, 0152, "j" }, - { 0x0135, 0, "jcircumflex" }, - { 0x006B, 0153, "k" }, - { 0x03BA, 0, "kappa" }, - { 0x0137, 0, "kcommaaccent" }, - { 0x0138, 0, "kgreenlandic" }, - { 0x006C, 0154, "l" }, - { 0x013A, 0, "lacute" }, - { 0x03BB, 0, "lambda" }, - { 0x013E, 0, "lcaron" }, - { 0x013C, 0, "lcommaaccent" }, - { 0x0140, 0, "ldot" }, - { 0x003C, 074, "less" }, - { 0x2264, 0, "lessequal" }, - { 0x258C, 0, "lfblock" }, - { 0x20A4, 0, "lira" }, - { 0xF6C0, 0, "ll" }, - { 0x2227, 0, "logicaland" }, - { 0x00AC, 0, "logicalnot" }, - { 0x2228, 0, "logicalor" }, - { 0x017F, 0, "longs" }, - { 0x25CA, 0, "lozenge" }, - { 0x0142, 0370, "lslash" }, - { 0xF6EE, 0, "lsuperior" }, - { 0x2591, 0, "ltshade" }, - { 0x006D, 0155, "m" }, - { 0x00AF, 0305, "macron" }, - { 0x02C9, 0305, "macron" }, - { 0x2642, 0, "male" }, - { 0x2212, 0, "minus" }, - { 0x2032, 0, "minute" }, - { 0xF6EF, 0, "msuperior" }, - { 0x00B5, 0, "mu" }, - { 0x03BC, 0, "mu" }, - { 0x00D7, 0, "multiply" }, - { 0x266A, 0, "musicalnote" }, - { 0x266B, 0, "musicalnotedbl" }, - { 0x006E, 0156, "n" }, - { 0x0144, 0, "nacute" }, - { 0x0149, 0, "napostrophe" }, - { 0x0148, 0, "ncaron" }, - { 0x0146, 0, "ncommaaccent" }, - { 0x0039, 071, "nine" }, - { 0x2089, 0, "nineinferior" }, - { 0xF739, 0, "nineoldstyle" }, - { 0x2079, 0, "ninesuperior" }, - { 0x2209, 0, "notelement" }, - { 0x2260, 0, "notequal" }, - { 0x2284, 0, "notsubset" }, - { 0x207F, 0, "nsuperior" }, - { 0x00F1, 0, "ntilde" }, - { 0x03BD, 0, "nu" }, - { 0x0023, 043, "numbersign" }, - { 0x006F, 0157, "o" }, - { 0x00F3, 0, "oacute" }, - { 0x014F, 0, "obreve" }, - { 0x00F4, 0, "ocircumflex" }, - { 0x00F6, 0, "odieresis" }, - { 0x0153, 0372, "oe" }, - { 0x02DB, 0316, "ogonek" }, - { 0x00F2, 0, "ograve" }, - { 0x01A1, 0, "ohorn" }, - { 0x0151, 0, "ohungarumlaut" }, - { 0x014D, 0, "omacron" }, - { 0x03C9, 0, "omega" }, - { 0x03D6, 0, "omega1" }, - { 0x03CE, 0, "omegatonos" }, - { 0x03BF, 0, "omicron" }, - { 0x03CC, 0, "omicrontonos" }, - { 0x0031, 061, "one" }, - { 0x2024, 0, "onedotenleader" }, - { 0x215B, 0, "oneeighth" }, - { 0xF6DC, 0, "onefitted" }, - { 0x00BD, 0, "onehalf" }, - { 0x2081, 0, "oneinferior" }, - { 0xF731, 0, "oneoldstyle" }, - { 0x00BC, 0, "onequarter" }, - { 0x00B9, 0, "onesuperior" }, - { 0x2153, 0, "onethird" }, - { 0x25E6, 0, "openbullet" }, - { 0x00AA, 0343, "ordfeminine" }, - { 0x00BA, 0353, "ordmasculine" }, - { 0x221F, 0, "orthogonal" }, - { 0x00F8, 0371, "oslash" }, - { 0x01FF, 0, "oslashacute" }, - { 0xF6F0, 0, "osuperior" }, - { 0x00F5, 0, "otilde" }, - { 0x0070, 0160, "p" }, - { 0x00B6, 0266, "paragraph" }, - { 0x0028, 050, "parenleft" }, - { 0xF8ED, 0, "parenleftbt" }, - { 0xF8EC, 0, "parenleftex" }, - { 0x208D, 0, "parenleftinferior" }, - { 0x207D, 0, "parenleftsuperior" }, - { 0xF8EB, 0, "parenlefttp" }, - { 0x0029, 051, "parenright" }, - { 0xF8F8, 0, "parenrightbt" }, - { 0xF8F7, 0, "parenrightex" }, - { 0x208E, 0, "parenrightinferior" }, - { 0x207E, 0, "parenrightsuperior" }, - { 0xF8F6, 0, "parenrighttp" }, - { 0x2202, 0, "partialdiff" }, - { 0x0025, 045, "percent" }, - { 0x002E, 056, "period" }, - { 0x00B7, 0264, "periodcentered" }, - { 0x2219, 0, "periodcentered" }, - { 0xF6E7, 0, "periodinferior" }, - { 0xF6E8, 0, "periodsuperior" }, - { 0x22A5, 0, "perpendicular" }, - { 0x2030, 0275, "perthousand" }, - { 0x20A7, 0, "peseta" }, - { 0x03C6, 0, "phi" }, - { 0x03D5, 0, "phi1" }, - { 0x03C0, 0, "pi" }, - { 0x002B, 053, "plus" }, - { 0x00B1, 0, "plusminus" }, - { 0x211E, 0, "prescription" }, - { 0x220F, 0, "product" }, - { 0x2282, 0, "propersubset" }, - { 0x2283, 0, "propersuperset" }, - { 0x221D, 0, "proportional" }, - { 0x03C8, 0, "psi" }, - { 0x0071, 0161, "q" }, - { 0x003F, 077, "question" }, - { 0x00BF, 0277, "questiondown" }, - { 0xF7BF, 0, "questiondownsmall" }, - { 0xF73F, 0, "questionsmall" }, - { 0x0022, 042, "quotedbl" }, - { 0x201E, 0271, "quotedblbase" }, - { 0x201C, 0252, "quotedblleft" }, - { 0x201D, 0272, "quotedblright" }, - { 0x2018, 0140, "quoteleft" }, - { 0x201B, 0, "quotereversed" }, - { 0x2019, 047, "quoteright" }, - { 0x201A, 0270, "quotesinglbase" }, - { 0x0027, 0251, "quotesingle" }, - { 0x0072, 0162, "r" }, - { 0x0155, 0, "racute" }, - { 0x221A, 0, "radical" }, - { 0xF8E5, 0, "radicalex" }, - { 0x0159, 0, "rcaron" }, - { 0x0157, 0, "rcommaaccent" }, - { 0x2286, 0, "reflexsubset" }, - { 0x2287, 0, "reflexsuperset" }, - { 0x00AE, 0, "registered" }, - { 0xF8E8, 0, "registersans" }, - { 0xF6DA, 0, "registerserif" }, - { 0x2310, 0, "revlogicalnot" }, - { 0x03C1, 0, "rho" }, - { 0x02DA, 0312, "ring" }, - { 0xF6F1, 0, "rsuperior" }, - { 0x2590, 0, "rtblock" }, - { 0xF6DD, 0, "rupiah" }, - { 0x0073, 0163, "s" }, - { 0x015B, 0, "sacute" }, - { 0x0161, 0, "scaron" }, - { 0x015F, 0, "scedilla" }, - { 0xF6C2, 0, "scedilla" }, - { 0x015D, 0, "scircumflex" }, - { 0x0219, 0, "scommaaccent" }, - { 0x2033, 0, "second" }, - { 0x00A7, 0247, "section" }, - { 0x003B, 073, "semicolon" }, - { 0x0037, 067, "seven" }, - { 0x215E, 0, "seveneighths" }, - { 0x2087, 0, "seveninferior" }, - { 0xF737, 0, "sevenoldstyle" }, - { 0x2077, 0, "sevensuperior" }, - { 0x2592, 0, "shade" }, - { 0x03C3, 0, "sigma" }, - { 0x03C2, 0, "sigma1" }, - { 0x223C, 0, "similar" }, - { 0x0036, 066, "six" }, - { 0x2086, 0, "sixinferior" }, - { 0xF736, 0, "sixoldstyle" }, - { 0x2076, 0, "sixsuperior" }, - { 0x002F, 057, "slash" }, - { 0x263A, 0, "smileface" }, - { 0x0020, 040, "space" }, - { 0x00A0, 040, "space" }, - { 0x2660, 0, "spade" }, - { 0xF6F2, 0, "ssuperior" }, - { 0x00A3, 0243, "sterling" }, - { 0x220B, 0, "suchthat" }, - { 0x2211, 0, "summation" }, - { 0x263C, 0, "sun" }, - { 0x0074, 0164, "t" }, - { 0x03C4, 0, "tau" }, - { 0x0167, 0, "tbar" }, - { 0x0165, 0, "tcaron" }, - { 0x0163, 0, "tcommaaccent" }, - { 0x021B, 0, "tcommaaccent" }, - { 0x2234, 0, "therefore" }, - { 0x03B8, 0, "theta" }, - { 0x03D1, 0, "theta1" }, - { 0x00FE, 0, "thorn" }, - { 0x0033, 063, "three" }, - { 0x215C, 0, "threeeighths" }, - { 0x2083, 0, "threeinferior" }, - { 0xF733, 0, "threeoldstyle" }, - { 0x00BE, 0, "threequarters" }, - { 0xF6DE, 0, "threequartersemdash" }, - { 0x00B3, 0, "threesuperior" }, - { 0x02DC, 0304, "tilde" }, - { 0x0303, 0, "tildecomb" }, - { 0x0384, 0, "tonos" }, - { 0x2122, 0, "trademark" }, - { 0xF8EA, 0, "trademarksans" }, - { 0xF6DB, 0, "trademarkserif" }, - { 0x25BC, 0, "triagdn" }, - { 0x25C4, 0, "triaglf" }, - { 0x25BA, 0, "triagrt" }, - { 0x25B2, 0, "triagup" }, - { 0xF6F3, 0, "tsuperior" }, - { 0x0032, 062, "two" }, - { 0x2025, 0, "twodotenleader" }, - { 0x2082, 0, "twoinferior" }, - { 0xF732, 0, "twooldstyle" }, - { 0x00B2, 0, "twosuperior" }, - { 0x2154, 0, "twothirds" }, - { 0x0075, 0165, "u" }, - { 0x00FA, 0, "uacute" }, - { 0x016D, 0, "ubreve" }, - { 0x00FB, 0, "ucircumflex" }, - { 0x00FC, 0, "udieresis" }, - { 0x00F9, 0, "ugrave" }, - { 0x01B0, 0, "uhorn" }, - { 0x0171, 0, "uhungarumlaut" }, - { 0x016B, 0, "umacron" }, - { 0x005F, 0137, "underscore" }, - { 0x2017, 0, "underscoredbl" }, - { 0x222A, 0, "union" }, - { 0x2200, 0, "universal" }, - { 0x0173, 0, "uogonek" }, - { 0x2580, 0, "upblock" }, - { 0x03C5, 0, "upsilon" }, - { 0x03CB, 0, "upsilondieresis" }, - { 0x03B0, 0, "upsilondieresistonos" }, - { 0x03CD, 0, "upsilontonos" }, - { 0x016F, 0, "uring" }, - { 0x0169, 0, "utilde" }, - { 0x0076, 0166, "v" }, - { 0x0077, 0167, "w" }, - { 0x1E83, 0, "wacute" }, - { 0x0175, 0, "wcircumflex" }, - { 0x1E85, 0, "wdieresis" }, - { 0x2118, 0, "weierstrass" }, - { 0x1E81, 0, "wgrave" }, - { 0x0078, 0170, "x" }, - { 0x03BE, 0, "xi" }, - { 0x0079, 0171, "y" }, - { 0x00FD, 0, "yacute" }, - { 0x0177, 0, "ycircumflex" }, - { 0x00FF, 0, "ydieresis" }, - { 0x00A5, 0245, "yen" }, - { 0x1EF3, 0, "ygrave" }, - { 0x007A, 0172, "z" }, - { 0x017A, 0, "zacute" }, - { 0x017E, 0, "zcaron" }, - { 0x017C, 0, "zdotaccent" }, - { 0x0030, 060, "zero" }, - { 0x2080, 0, "zeroinferior" }, - { 0xF730, 0, "zerooldstyle" }, - { 0x2070, 0, "zerosuperior" }, - { 0x03B6, 0, "zeta" } -}; diff --git a/vcl/unx/generic/fontmanager/afm_keyword_list b/vcl/unx/generic/fontmanager/afm_keyword_list deleted file mode 100644 index c9bb13467e3e..000000000000 --- a/vcl/unx/generic/fontmanager/afm_keyword_list +++ /dev/null @@ -1,62 +0,0 @@ -%language=C++ -%global-table -%null-strings -%struct-type -struct hash_entry { const char* name; enum parseKey eKey; }; -%% -Ascender,ASCENDER -Ascent,ASCENT -B,CHARBBOX -C,CODE -CC,COMPCHAR -CH,CODEHEX -CapHeight,CAPHEIGHT -CharWidth,CHARWIDTH -CharacterSet,CHARACTERSET -Characters,CHARACTERS -Comment,COMMENT -Descender,DESCENDER -Descent,DESCENT -Em,EM -EncodingScheme,ENCODINGSCHEME -EndCharMetrics,ENDCHARMETRICS -EndComposites,ENDCOMPOSITES -EndDirection,ENDDIRECTION -EndFontMetrics,ENDFONTMETRICS -EndKernData,ENDKERNDATA -EndKernPairs,ENDKERNPAIRS -EndTrackKern,ENDTRACKKERN -FamilyName,FAMILYNAME -FontBBox,FONTBBOX -FontName,FONTNAME -FullName,FULLNAME -IsBaseFont,ISBASEFONT -IsFixedPitch,ISFIXEDPITCH -ItalicAngle,ITALICANGLE -KP,KERNPAIR -KPX,KERNPAIRXAMT -L,LIGATURE -MappingScheme,MAPPINGSCHEME -MetricsSets,METRICSSETS -N,CHARNAME -Notice,NOTICE -PCC,COMPCHARPIECE -StartCharMetrics,STARTCHARMETRICS -StartComposites,STARTCOMPOSITES -StartDirection,STARTDIRECTION -StartFontMetrics,STARTFONTMETRICS -StartKernData,STARTKERNDATA -StartKernPairs,STARTKERNPAIRS -StartTrackKern,STARTTRACKKERN -StdHW,STDHW -StdVW,STDVW -TrackKern,TRACKKERN -UnderlinePosition,UNDERLINEPOSITION -UnderlineThickness,UNDERLINETHICKNESS -V,VVECTOR -Version,VERSION -W,XYWIDTH -W0X,X0WIDTH -WX,XWIDTH -Weight,WEIGHT -XHeight,XHEIGHT diff --git a/vcl/unx/generic/fontmanager/fontcache.cxx b/vcl/unx/generic/fontmanager/fontcache.cxx index e308db8018b7..5c6df511e74b 100644 --- a/vcl/unx/generic/fontmanager/fontcache.cxx +++ b/vcl/unx/generic/fontmanager/fontcache.cxx @@ -37,7 +37,7 @@ #include <cstdio> #endif -#define CACHE_MAGIC "LibreOffice PspFontCacheFile format 6" +#define CACHE_MAGIC "LibreOffice PspFontCacheFile format 7" using namespace std; using namespace psp; @@ -203,10 +203,6 @@ void FontCache::flush() switch( (*it)->m_eType ) { - case fonttype::Type1: - aLine.append(';'); - aLine.append(static_cast<const PrintFontManager::Type1FontFile*>(*it)->m_aMetricFile); - break; case fonttype::TrueType: aLine.append(';'); aLine.append(static_cast<sal_Int32>(static_cast<const PrintFontManager::TrueTypeFontFile*>(*it)->m_nTypeFlags)); @@ -313,8 +309,7 @@ void FontCache::read() const char* pLine = aLine.getStr(); fonttype::type eType = (fonttype::type)atoi( pLine ); - if( eType != fonttype::TrueType && - eType != fonttype::Type1 ) + if( eType != fonttype::TrueType ) continue; while( *pLine && *pLine != ';' ) pLine++; @@ -335,9 +330,6 @@ void FontCache::read() case fonttype::TrueType: pFont = new PrintFontManager::TrueTypeFontFile(); break; - case fonttype::Type1: - pFont = new PrintFontManager::Type1FontFile(); - break; default: break; } @@ -414,14 +406,6 @@ void FontCache::read() static_cast<PrintFontManager::TrueTypeFontFile*>(pFont)->m_aFontFile = aFile; nStyleTokenNr++; break; - case fonttype::Type1: - { - int nTokLen = (nTokens > 19 ) ? nTokenPos[19]-nTokenPos[18]-1 : nLen - nTokenPos[18]; - static_cast<PrintFontManager::Type1FontFile*>(pFont)->m_aMetricFile = OString( pLine + nTokenPos[18], nTokLen ); - static_cast<PrintFontManager::Type1FontFile*>(pFont)->m_nDirectory = nDir; - static_cast<PrintFontManager::Type1FontFile*>(pFont)->m_aFontFile = aFile; - nStyleTokenNr++; - } break; default: break; } @@ -485,11 +469,6 @@ void FontCache::copyPrintFont( const PrintFontManager::PrintFont* pFrom, PrintFo static_cast<PrintFontManager::TrueTypeFontFile*>(pTo)->m_nCollectionEntry = static_cast<const PrintFontManager::TrueTypeFontFile*>(pFrom)->m_nCollectionEntry; static_cast<PrintFontManager::TrueTypeFontFile*>(pTo)->m_nTypeFlags = static_cast<const PrintFontManager::TrueTypeFontFile*>(pFrom)->m_nTypeFlags; break; - case fonttype::Type1: - static_cast<PrintFontManager::Type1FontFile*>(pTo)->m_nDirectory = static_cast<const PrintFontManager::Type1FontFile*>(pFrom)->m_nDirectory; - static_cast<PrintFontManager::Type1FontFile*>(pTo)->m_aFontFile = static_cast<const PrintFontManager::Type1FontFile*>(pFrom)->m_aFontFile; - static_cast<PrintFontManager::Type1FontFile*>(pTo)->m_aMetricFile = static_cast<const PrintFontManager::Type1FontFile*>(pFrom)->m_aMetricFile; - break; default: break; } pTo->m_nFamilyName = pFrom->m_nFamilyName; @@ -534,16 +513,6 @@ bool FontCache::equalsPrintFont( const PrintFontManager::PrintFont* pLeft, Print return false; } break; - case fonttype::Type1: - { - const PrintFontManager::Type1FontFile* pLT = static_cast<const PrintFontManager::Type1FontFile*>(pLeft); - const PrintFontManager::Type1FontFile* pRT = static_cast<const PrintFontManager::Type1FontFile*>(pRight); - if( pRT->m_nDirectory != pLT->m_nDirectory || - pRT->m_aFontFile != pLT->m_aFontFile || - pRT->m_aMetricFile != pLT->m_aMetricFile ) - return false; - } - break; default: break; } if( pRight->m_nFamilyName != pLeft->m_nFamilyName || @@ -586,9 +555,6 @@ PrintFontManager::PrintFont* FontCache::clonePrintFont( const PrintFontManager:: case fonttype::TrueType: pFont = new PrintFontManager::TrueTypeFontFile(); break; - case fonttype::Type1: - pFont = new PrintFontManager::Type1FontFile(); - break; default: break; } if( pFont ) @@ -635,10 +601,6 @@ void FontCache::updateFontCacheEntry( const PrintFontManager::PrintFont* pFont, nDirID = static_cast<const PrintFontManager::TrueTypeFontFile*>(pFont)->m_nDirectory; aFile = static_cast<const PrintFontManager::TrueTypeFontFile*>(pFont)->m_aFontFile; break; - case fonttype::Type1: - nDirID = static_cast<const PrintFontManager::Type1FontFile*>(pFont)->m_nDirectory; - aFile = static_cast<const PrintFontManager::Type1FontFile*>(pFont)->m_aFontFile; - break; default: return; } diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx index 488e675e9b82..4c839f4fbf2b 100644 --- a/vcl/unx/generic/fontmanager/fontmanager.cxx +++ b/vcl/unx/generic/fontmanager/fontmanager.cxx @@ -52,7 +52,6 @@ #include "i18nlangtag/applelangid.hxx" #include "i18nlangtag/mslangid.hxx" -#include "parseAFM.hxx" #include "sft.hxx" #if OSL_DEBUG_LEVEL > 1 @@ -62,9 +61,6 @@ #include <algorithm> #include <set> -#include <unordered_set> - -#include "adobe_encoding_table.hxx" #ifdef CALLGRIND_COMPILE #include <valgrind/callgrind.h> @@ -95,43 +91,6 @@ inline sal_uInt16 getUInt16BE( const sal_uInt8*& pBuffer ) return nRet; } -static FontWeight parseWeight( const OString& rWeight ) -{ - FontWeight eWeight = WEIGHT_DONTKNOW; - if (rWeight.indexOf("bold") != -1) - { - if (rWeight.indexOf("emi") != -1) // semi, demi - eWeight = WEIGHT_SEMIBOLD; - else if (rWeight.indexOf("ultra") != -1) - eWeight = WEIGHT_ULTRABOLD; - else - eWeight = WEIGHT_BOLD; - } - else if (rWeight.indexOf("heavy") != -1) - eWeight = WEIGHT_BOLD; - else if (rWeight.indexOf("light") != -1) - { - if (rWeight.indexOf("emi") != -1) // semi, demi - eWeight = WEIGHT_SEMILIGHT; - else if (rWeight.indexOf("ultra") != -1) - eWeight = WEIGHT_ULTRALIGHT; - else - eWeight = WEIGHT_LIGHT; - } - else if (rWeight.indexOf("black") != -1) - eWeight = WEIGHT_BLACK; - else if (rWeight == "demi") - eWeight = WEIGHT_SEMIBOLD; - else if ((rWeight == "book") || - (rWeight == "semicondensed")) - eWeight = WEIGHT_LIGHT; - else if ((rWeight == "medium") || (rWeight == "roman")) - eWeight = WEIGHT_MEDIUM; - else - eWeight = WEIGHT_NORMAL; - return eWeight; -} - /* * PrintFont implementations */ @@ -144,7 +103,6 @@ PrintFontManager::PrintFont::PrintFont( fonttype::type eType ) : m_eWeight( WEIGHT_DONTKNOW ), m_ePitch( PITCH_DONTKNOW ), m_aEncoding( RTL_TEXTENCODING_DONTKNOW ), - m_bFontEncodingOnly( false ), m_pMetrics( nullptr ), m_nAscend( 0 ), m_nDescend( 0 ), @@ -163,10 +121,6 @@ PrintFontManager::PrintFont::~PrintFont() delete m_pMetrics; } -PrintFontManager::Type1FontFile::~Type1FontFile() -{ -} - PrintFontManager::TrueTypeFontFile::TrueTypeFontFile() : PrintFont( fonttype::TrueType ) , m_nDirectory( 0 ) @@ -178,11 +132,6 @@ PrintFontManager::TrueTypeFontFile::~TrueTypeFontFile() { } -bool PrintFontManager::Type1FontFile::queryMetricPage( int /*nPage*/, MultiAtomProvider* pProvider ) -{ - return readAfmMetrics( pProvider, false, false ); -} - bool PrintFontManager::TrueTypeFontFile::queryMetricPage( int nPage, MultiAtomProvider* /*pProvider*/ ) { bool bSuccess = false; @@ -248,396 +197,6 @@ bool PrintFontManager::TrueTypeFontFile::queryMetricPage( int nPage, MultiAtomPr return bSuccess; } -/* #i73387# There seem to be fonts with a rather unwell chosen family name -* consider e.g. "Helvetica Narrow" which defines its family as "Helvetica" -* It can really only be distinguished by its PSName and FullName. Both of -* which are not user presentable in OOo. So replace it by something sensible. -* -* If other fonts feature this behaviour, insert them to the map. -*/ -static bool familyNameOverride( const OUString& i_rPSname, OUString& o_rFamilyName ) -{ - static std::unordered_map< OUString, OUString, OUStringHash > aPSNameToFamily( 16 ); - if( aPSNameToFamily.empty() ) // initialization - { - aPSNameToFamily[ "Helvetica-Narrow" ] = "Helvetica Narrow"; - aPSNameToFamily[ "Helvetica-Narrow-Bold" ] = "Helvetica Narrow"; - aPSNameToFamily[ "Helvetica-Narrow-BoldOblique" ] = "Helvetica Narrow"; - aPSNameToFamily[ "Helvetica-Narrow-Oblique" ] = "Helvetica Narrow"; - } - std::unordered_map<OUString,OUString,OUStringHash>::const_iterator it = - aPSNameToFamily.find( i_rPSname ); - bool bReplaced = (it != aPSNameToFamily.end() ); - if( bReplaced ) - o_rFamilyName = it->second; - return bReplaced; -}; - -bool PrintFontManager::PrintFont::readAfmMetrics( MultiAtomProvider* pProvider, bool bFillEncodingvector, bool bOnlyGlobalAttributes ) -{ - PrintFontManager& rManager( PrintFontManager::get() ); - const OString& rFileName = rManager.getAfmFile( this ); - - FontInfo* pInfo = nullptr; - parseFile( rFileName.getStr(), &pInfo, P_ALL ); - if( ! pInfo || ! pInfo->numOfChars ) - { - if( pInfo ) - freeFontInfo( pInfo ); - return false; - } - - m_aEncodingVector.clear(); - m_aEncodingVectorPriority.clear(); - // fill in global info - - // PSName - OUString aPSName( OStringToOUString( pInfo->gfi->fontName, RTL_TEXTENCODING_ISO_8859_1 ) ); - m_nPSName = pProvider->getAtom( ATOM_PSNAME, aPSName ); - - // family name (if not already set) - OUString aFamily; - if( ! m_nFamilyName ) - { - aFamily = OStringToOUString( pInfo->gfi->familyName, RTL_TEXTENCODING_ISO_8859_1 ); - if( aFamily.isEmpty() ) - { - aFamily = OStringToOUString( pInfo->gfi->fontName, RTL_TEXTENCODING_ISO_8859_1 ); - sal_Int32 nIndex = 0; - aFamily = aFamily.getToken( 0, '-', nIndex ); - } - familyNameOverride( aPSName, aFamily ); - m_nFamilyName = pProvider->getAtom( ATOM_FAMILYNAME, aFamily ); - } - else - aFamily = pProvider->getString( ATOM_FAMILYNAME, m_nFamilyName ); - - // style name: if fullname begins with family name - // interpret the rest of fullname as style - if( m_aStyleName.isEmpty() && pInfo->gfi->fullName && *pInfo->gfi->fullName ) - { - OUString aFullName( OStringToOUString( pInfo->gfi->fullName, RTL_TEXTENCODING_ISO_8859_1 ) ); - if( aFullName.startsWith( aFamily ) ) - m_aStyleName = WhitespaceToSpace( aFullName.copy( aFamily.getLength() ) ); - } - - // italic - if( pInfo->gfi->italicAngle > 0 ) - m_eItalic = ITALIC_OBLIQUE; - else if( pInfo->gfi->italicAngle < 0 ) - m_eItalic = ITALIC_NORMAL; - else - m_eItalic = ITALIC_NONE; - - // weight - OString aWeight( pInfo->gfi->weight ); - m_eWeight = parseWeight( aWeight.toAsciiLowerCase() ); - - // pitch - m_ePitch = pInfo->gfi->isFixedPitch ? PITCH_FIXED : PITCH_VARIABLE; - - // encoding - only set if unknown - int nAdobeEncoding = 0; - if( pInfo->gfi->encodingScheme ) - { - if( !strcmp( pInfo->gfi->encodingScheme, "AdobeStandardEncoding" ) ) - nAdobeEncoding = 1; - else if( !strcmp( pInfo->gfi->encodingScheme, "ISO10646-1" ) ) - { - nAdobeEncoding = 1; - m_aEncoding = RTL_TEXTENCODING_UNICODE; - } - else if( !strcmp( pInfo->gfi->encodingScheme, "Symbol") ) - nAdobeEncoding = 2; - else if( !strcmp( pInfo->gfi->encodingScheme, "FontSpecific") ) - nAdobeEncoding = 3; - - if( m_aEncoding == RTL_TEXTENCODING_DONTKNOW ) - m_aEncoding = nAdobeEncoding == 1 ? - RTL_TEXTENCODING_ADOBE_STANDARD : RTL_TEXTENCODING_SYMBOL; - } - else if( m_aEncoding == RTL_TEXTENCODING_DONTKNOW ) - m_aEncoding = RTL_TEXTENCODING_ADOBE_STANDARD; - - // try to parse the font name and decide whether it might be a - // japanese font. Who invented this PITA ? - OUString aPSNameLastToken( aPSName.copy( aPSName.lastIndexOf( '-' )+1 ) ); - if( aPSNameLastToken == "H" || - aPSNameLastToken == "V" ) - { - static const char* pEncs[] = - { - "EUC", - "RKSJ", - "SJ" - }; - static const rtl_TextEncoding aEncs[] = - { - RTL_TEXTENCODING_EUC_JP, - RTL_TEXTENCODING_SHIFT_JIS, - RTL_TEXTENCODING_JIS_X_0208 - }; - - for( unsigned int enc = 0; enc < SAL_N_ELEMENTS( aEncs ) && m_aEncoding == RTL_TEXTENCODING_DONTKNOW; enc++ ) - { - sal_Int32 nIndex = 0, nOffset = 1; - do - { - OUString aToken( aPSName.getToken( nOffset, '-', nIndex ) ); - if( nIndex == -1 ) - break; - nOffset = 0; - if( aToken.equalsAscii( pEncs[enc] ) ) - { - m_aEncoding = aEncs[ enc ]; - m_bFontEncodingOnly = true; - } - } while( nIndex != -1 ); - } - - // default is jis - if( m_aEncoding == RTL_TEXTENCODING_DONTKNOW ) - m_aEncoding = RTL_TEXTENCODING_JIS_X_0208; -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "Encoding %d for %s\n", m_aEncoding, pInfo->gfi->fontName ); -#endif - } - - // #i37313# check if Fontspecific is not rather some character encoding - if( nAdobeEncoding == 3 && m_aEncoding == RTL_TEXTENCODING_SYMBOL ) - { - bool bYFound = false; - bool bQFound = false; - CharMetricInfo* pChar = pInfo->cmi; - for( int j = 0; j < pInfo->numOfChars && ! (bYFound && bQFound); j++ ) - { - if( pChar[j].name ) - { - if( pChar[j].name[0] == 'Y' && pChar[j].name[1] == 0 ) - bYFound = true; - else if( pChar[j].name[0] == 'Q' && pChar[j].name[1] == 0 ) - bQFound = true; - } - } - if( bQFound && bYFound ) - { - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "setting FontSpecific font %s (file %s) to unicode\n", - pInfo->gfi->fontName, - rFileName.getStr() - ); - #endif - nAdobeEncoding = 4; - m_aEncoding = RTL_TEXTENCODING_UNICODE; - bFillEncodingvector = false; // will be filled anyway, don't do the work twice - } - } - - // ascend - m_nAscend = pInfo->gfi->fontBBox.ury; - - // descend - // descends have opposite sign of our definition - m_nDescend = -pInfo->gfi->fontBBox.lly; - - // fallback to ascender, descender - // interesting: the BBox seems to describe Ascender and Descender better - // as we understand it - if( m_nAscend == 0 ) - m_nAscend = pInfo->gfi->ascender; - if( m_nDescend == 0) - m_nDescend = -pInfo->gfi->descender; - - m_nLeading = m_nAscend + m_nDescend - 1000; - - delete m_pMetrics; - m_pMetrics = new PrintFontMetrics; - // mark all pages as queried (or clear if only global font info queried) - memset( m_pMetrics->m_aPages, bOnlyGlobalAttributes ? 0 : 0xff, sizeof( m_pMetrics->m_aPages ) ); - - m_aGlobalMetricX.width = m_aGlobalMetricY.width = - pInfo->gfi->charwidth ? pInfo->gfi->charwidth : pInfo->gfi->fontBBox.urx; - m_aGlobalMetricX.height = m_aGlobalMetricY.height = - pInfo->gfi->capHeight ? pInfo->gfi->capHeight : pInfo->gfi->fontBBox.ury; - - m_nXMin = pInfo->gfi->fontBBox.llx; - m_nYMin = pInfo->gfi->fontBBox.lly; - m_nXMax = pInfo->gfi->fontBBox.urx; - m_nYMax = pInfo->gfi->fontBBox.ury; - - if( bFillEncodingvector || !bOnlyGlobalAttributes ) - { - // fill in character metrics - - // first transform the character codes to unicode - // note: this only works with single byte encodings - std::unique_ptr<sal_Unicode[]> const pUnicodes(new sal_Unicode[pInfo->numOfChars]); - CharMetricInfo* pChar = pInfo->cmi; - int i; - - for( i = 0; i < pInfo->numOfChars; i++, pChar++ ) - { - if( nAdobeEncoding == 4 ) - { - if( pChar->name ) - { - pUnicodes[i] = 0; - std::vector< sal_Unicode > aCodes = rManager.getUnicodeFromAdobeName( pChar->name ); - for( std::vector< sal_Unicode >::const_iterator it = aCodes.begin(); it != aCodes.end(); ++it ) - { - if( *it != 0 ) - { - m_aEncodingVector[ *it ] = pChar->code; - if( pChar->code == -1 ) - m_aNonEncoded[ *it ] = pChar->name; - if( ! pUnicodes[i] ) // map the first - pUnicodes[i] = *it; - } - } - } - } - else if( pChar->code != -1 ) - { - if( nAdobeEncoding == 3 && m_aEncoding == RTL_TEXTENCODING_SYMBOL ) - { - pUnicodes[i] = pChar->code + 0xf000; - if( bFillEncodingvector ) - { - m_aEncodingVector[ pUnicodes[i] ] = pChar->code; - m_aEncodingVectorPriority.insert(pUnicodes[i]); - } - continue; - } - - if( m_aEncoding == RTL_TEXTENCODING_UNICODE ) - { - pUnicodes[i] = (sal_Unicode)pChar->code; - continue; - } - - OStringBuffer aTranslate; - if( pChar->code & 0xff000000 ) - aTranslate.append((char)(pChar->code >> 24)); - if( pChar->code & 0xffff0000 ) - aTranslate.append((char)((pChar->code & 0x00ff0000) >> 16)); - if( pChar->code & 0xffffff00 ) - aTranslate.append((char)((pChar->code & 0x0000ff00) >> 8 )); - aTranslate.append((char)(pChar->code & 0xff)); - OUString aUni(OStringToOUString(aTranslate.makeStringAndClear(), m_aEncoding)); - pUnicodes[i] = aUni.toChar(); - } - else - pUnicodes[i] = 0; - } - - // now fill in the character metrics - // parseAFM.cxx effectively only supports direction 0 (horizontal) - pChar = pInfo->cmi; - CharacterMetric aMetric; - for( i = 0; i < pInfo->numOfChars; i++, pChar++ ) - { - if( pChar->code == -1 && ! pChar->name ) - continue; - - if( bFillEncodingvector && pChar->name ) - { - std::vector< sal_Unicode > aCodes = rManager.getUnicodeFromAdobeName( pChar->name ); - for( std::vector< sal_Unicode >::const_iterator it = aCodes.begin(); it != aCodes.end(); ++it ) - { - if( *it != 0 ) - { - m_aEncodingVector[ *it ] = pChar->code; - if( pChar->code == -1 ) - m_aNonEncoded[ *it ] = pChar->name; - } - } - } - - aMetric.width = pChar->wx ? pChar->wx : pChar->charBBox.urx; - aMetric.height = pChar->wy ? pChar->wy : pChar->charBBox.ury - pChar->charBBox.lly; - if( aMetric.width == 0 && aMetric.height == 0 ) - // guess something for e.g. space - aMetric.width = m_aGlobalMetricX.width/4; - - if( ( nAdobeEncoding == 0 ) || - ( ( nAdobeEncoding == 3 ) && ( m_aEncoding != RTL_TEXTENCODING_SYMBOL ) ) ) - { - if( pChar->code != -1 ) - { - m_pMetrics->m_aMetrics[ pUnicodes[i] ] = aMetric; - if( bFillEncodingvector ) - { - m_aEncodingVector[ pUnicodes[i] ] = pChar->code; - m_aEncodingVectorPriority.insert(pUnicodes[i]); - } - } - else if( pChar->name ) - { - std::vector< sal_Unicode > aCodes = rManager.getUnicodeFromAdobeName( pChar->name ); - for( std::vector< sal_Unicode >::const_iterator it = aCodes.begin(); it != aCodes.end(); ++it ) - { - if( *it != 0 ) - m_pMetrics->m_aMetrics[ *it ] = aMetric; - } - } - } - else if( nAdobeEncoding == 1 || nAdobeEncoding == 2 || nAdobeEncoding == 4) - { - if( pChar->name ) - { - std::vector< sal_Unicode > aCodes = rManager.getUnicodeFromAdobeName( pChar->name ); - for( std::vector< sal_Unicode >::const_iterator it = aCodes.begin(); it != aCodes.end(); ++it ) - { - if( *it != 0 ) - m_pMetrics->m_aMetrics[ *it ] = aMetric; - } - } - else if( pChar->code != -1 ) - { - ::std::pair< std::unordered_multimap< sal_uInt8, sal_Unicode >::const_iterator, - std::unordered_multimap< sal_uInt8, sal_Unicode >::const_iterator > - aCodes = rManager.getUnicodeFromAdobeCode( pChar->code ); - bool bFirst = true; - while( aCodes.first != aCodes.second ) - { - if( (*aCodes.first).second != 0 ) - { - m_pMetrics->m_aMetrics[ (*aCodes.first).second ] = aMetric; - if( bFillEncodingvector ) - { - m_aEncodingVector[ (*aCodes.first).second ] = pChar->code; - if (bFirst) // arbitrarily prefer the first one - { - m_aEncodingVectorPriority.insert((*aCodes.first).second); - bFirst = false; - } - } - } - ++aCodes.first; - } - } - } - else if( nAdobeEncoding == 3 ) - { - if( pChar->code != -1 ) - { - sal_Unicode code = 0xf000 + pChar->code; - m_pMetrics->m_aMetrics[ code ] = aMetric; - // maybe should try to find the name in the convtabs ? - if( bFillEncodingvector ) - { - m_aEncodingVector[ code ] = pChar->code; - m_aEncodingVectorPriority.insert(code); - } - } - } - } - } - - freeFontInfo( pInfo ); - return true; -} - /* * one instance only */ @@ -663,17 +222,6 @@ PrintFontManager::PrintFontManager() , m_nNextDirAtom( 1 ) , m_pFontCache( nullptr ) { - for(const AdobeEncEntry& rEntry : aAdobeCodes) - { - m_aUnicodeToAdobename.insert( std::unordered_multimap< sal_Unicode, OString >::value_type( rEntry.aUnicode, rEntry.pAdobename ) ); - m_aAdobenameToUnicode.insert( std::unordered_multimap< OString, sal_Unicode, OStringHash >::value_type( rEntry.pAdobename, rEntry.aUnicode ) ); - if( rEntry.aAdobeStandardCode ) - { - m_aUnicodeToAdobecode.insert( std::unordered_multimap< sal_Unicode, sal_uInt8 >::value_type( rEntry.aUnicode, rEntry.aAdobeStandardCode ) ); - m_aAdobecodeToUnicode.insert( std::unordered_multimap< sal_uInt8, sal_Unicode >::value_type( rEntry.aAdobeStandardCode, rEntry.aUnicode ) ); - } - } - #if ENABLE_DBUS m_aFontInstallerTimer.SetTimeoutHdl(LINK(this, PrintFontManager, autoInstallFontLangSupport)); m_aFontInstallerTimer.SetTimeout(5000); @@ -743,7 +291,7 @@ std::vector<fontID> PrintFontManager::addFontFile( const OString& rFileName ) enum fontFormat { - UNKNOWN, TRUETYPE, CFF, TYPE1 + UNKNOWN, TRUETYPE, CFF }; bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, ::std::list< PrintFontManager::PrintFont* >& rNewFonts, const char *pFormat ) const @@ -767,15 +315,11 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, :: eFormat = TRUETYPE; else if (!strcmp(pFormat, "CFF")) eFormat = CFF; - else if (!strcmp(pFormat, "Type 1")) - eFormat = TYPE1; } if (eFormat == UNKNOWN) { OString aExt( rFontFile.copy( rFontFile.lastIndexOf( '.' )+1 ) ); - if( aExt.equalsIgnoreAsciiCase("pfb") || aExt.equalsIgnoreAsciiCase("pfa") ) - eFormat = TYPE1; - else if( aExt.equalsIgnoreAsciiCase("ttf") + if( aExt.equalsIgnoreAsciiCase("ttf") || aExt.equalsIgnoreAsciiCase("ttc") || aExt.equalsIgnoreAsciiCase("tte") ) // #i33947# for Gaiji support eFormat = TRUETYPE; @@ -783,53 +327,7 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, :: eFormat = CFF; } - if (eFormat == TYPE1) - { - // check for corresponding afm metric - // first look for an adjacent file - static const char* pSuffix[] = { ".afm", ".AFM" }; - - for(const char* i : pSuffix) - { - OString aName = OStringBuffer( - rFontFile.copy(0, rFontFile.getLength() - 4)). - append(i).makeStringAndClear(); - - OStringBuffer aFilePath(aDir); - aFilePath.append('/').append(aName); - - OString aAfmFile; - if( access( aFilePath.makeStringAndClear().getStr(), R_OK ) ) - { - // try in subdirectory afm instead - aFilePath.append(aDir).append("/afm/").append(aName); - - if (!access(aFilePath.getStr(), R_OK)) - aAfmFile = OString("afm/") + aName; - } - else - aAfmFile = aName; - - if( !aAfmFile.isEmpty() ) - { - Type1FontFile* pFont = new Type1FontFile(); - pFont->m_nDirectory = nDirID; - - pFont->m_aFontFile = rFontFile; - pFont->m_aMetricFile = aAfmFile; - - if( ! pFont->readAfmMetrics( m_pAtoms, false, true ) ) - { - delete pFont; - pFont = nullptr; - } - if( pFont ) - rNewFonts.push_back( pFont ); - break; - } - } - } - else if (eFormat == TRUETYPE || eFormat == CFF) + if (eFormat == TRUETYPE || eFormat == CFF) { // get number of ttc entries int nLength = CountTTCFonts( aFullPath.getStr() ); @@ -915,14 +413,6 @@ fontID PrintFontManager::findFontFileID( int nDirID, const OString& rFontFile, i continue; switch( it->second->m_eType ) { - case fonttype::Type1: - { - Type1FontFile* const pFont = static_cast< Type1FontFile* const >((*it).second); - if( pFont->m_nDirectory == nDirID && - pFont->m_aFontFile == rFontFile ) - nID = it->first; - } - break; case fonttype::TrueType: { TrueTypeFontFile* const pFont = static_cast< TrueTypeFontFile* const >((*it).second); @@ -954,14 +444,6 @@ std::vector<fontID> PrintFontManager::findFontFileIDs( int nDirID, const OString continue; switch( it->second->m_eType ) { - case fonttype::Type1: - { - Type1FontFile* const pFont = static_cast< Type1FontFile* const >((*it).second); - if( pFont->m_nDirectory == nDirID && - pFont->m_aFontFile == rFontFile ) - aIds.push_back(it->first); - } - break; case fonttype::TrueType: { TrueTypeFontFile* const pFont = static_cast< TrueTypeFontFile* const >((*it).second); @@ -1459,9 +941,7 @@ void PrintFontManager::initialize() { fontID aFont = m_nNextFontID++; m_aFonts[ aFont ] = *it; - if( (*it)->m_eType == fonttype::Type1 ) - m_aFontFileToFontID[ static_cast<Type1FontFile*>(*it)->m_aFontFile ].insert( aFont ); - else if( (*it)->m_eType == fonttype::TrueType ) + if( (*it)->m_eType == fonttype::TrueType ) m_aFontFileToFontID[ static_cast<TrueTypeFontFile*>(*it)->m_aFontFile ].insert( aFont ); #if OSL_DEBUG_LEVEL > 1 else @@ -1534,7 +1014,6 @@ void PrintFontManager::fillPrintFontInfo( PrintFont* pFont, FastPrintFontInfo& r rInfo.m_ePitch = pFont->m_ePitch; rInfo.m_aEncoding = pFont->m_aEncoding; - rInfo.m_bEmbeddable = (pFont->m_eType == fonttype::Type1); rInfo.m_bSubsettable = (pFont->m_eType == fonttype::TrueType); // TODO: rename to SfntType rInfo.m_aAliases.clear(); @@ -1548,10 +1027,8 @@ void PrintFontManager::fillPrintFontInfo( PrintFont* pFont, PrintFontInfo& rInfo ! pFont->m_pMetrics || pFont->m_pMetrics->isEmpty() ) { - // might be a truetype font not analyzed or type1 without metrics read - if( pFont->m_eType == fonttype::Type1 ) - pFont->readAfmMetrics( m_pAtoms, false, false ); - else if( pFont->m_eType == fonttype::TrueType ) + // might be a truetype font not analyzed + if( pFont->m_eType == fonttype::TrueType ) analyzeTrueTypeFile( pFont ); } @@ -1592,10 +1069,7 @@ void PrintFontManager::getFontBoundingBox( fontID nFontID, int& xMin, int& yMin, { if( pFont->m_nXMin == 0 && pFont->m_nYMin == 0 && pFont->m_nXMax == 0 && pFont->m_nYMax == 0 ) { - // might be a truetype font not analyzed or type1 without metrics read - if( pFont->m_eType == fonttype::Type1 ) - pFont->readAfmMetrics( m_pAtoms, false, true ); - else if( pFont->m_eType == fonttype::TrueType ) + if( pFont->m_eType == fonttype::TrueType ) analyzeTrueTypeFile( pFont ); } xMin = pFont->m_nXMin; @@ -1681,40 +1155,11 @@ FontFamily PrintFontManager::matchFamilyName( const OUString& rFamily ) return FAMILY_DONTKNOW; } -OString PrintFontManager::getAfmFile( PrintFont* pFont ) const -{ - OString aMetricPath; - if( pFont ) - { - switch( pFont->m_eType ) - { - case fonttype::Type1: - { - Type1FontFile* pPSFont = static_cast< Type1FontFile* >(pFont); - aMetricPath = getDirectory( pPSFont->m_nDirectory ); - aMetricPath += "/"; - aMetricPath += pPSFont->m_aMetricFile; - } - break; - default: break; - } - } - return aMetricPath; -} - OString PrintFontManager::getFontFile( PrintFont* pFont ) const { OString aPath; - if( pFont && pFont->m_eType == fonttype::Type1 ) - { - Type1FontFile* pPSFont = static_cast< Type1FontFile* >(pFont); - std::unordered_map< int, OString >::const_iterator it = m_aAtomToDir.find( pPSFont->m_nDirectory ); - aPath = it->second; - aPath += "/"; - aPath += pPSFont->m_aFontFile; - } - else if( pFont && pFont->m_eType == fonttype::TrueType ) + if( pFont && pFont->m_eType == fonttype::TrueType ) { TrueTypeFontFile* pTTFont = static_cast< TrueTypeFontFile* >(pFont); std::unordered_map< int, OString >::const_iterator it = m_aAtomToDir.find( pTTFont->m_nDirectory ); @@ -1745,8 +1190,6 @@ int PrintFontManager::getFontAscend( fontID nFontID ) const // might be a truetype font not yet analyzed if( pFont->m_eType == fonttype::TrueType ) analyzeTrueTypeFile( pFont ); - else if( pFont->m_eType == fonttype::Type1 ) - pFont->readAfmMetrics( m_pAtoms, false, true ); } return pFont ? pFont->m_nAscend : 0; } @@ -1759,8 +1202,6 @@ int PrintFontManager::getFontDescend( fontID nFontID ) const // might be a truetype font not yet analyzed if( pFont->m_eType == fonttype::TrueType ) analyzeTrueTypeFile( pFont ); - else if( pFont->m_eType == fonttype::Type1 ) - pFont->readAfmMetrics( m_pAtoms, false, true ); } return pFont ? pFont->m_nDescend : 0; } @@ -1839,9 +1280,7 @@ bool PrintFontManager::getMetrics( fontID nFontID, const sal_Unicode* pString, i ) { // might be a font not yet analyzed - if( pFont->m_eType == fonttype::Type1 ) - pFont->readAfmMetrics( m_pAtoms, false, false ); - else if( pFont->m_eType == fonttype::TrueType ) + if( pFont->m_eType == fonttype::TrueType ) analyzeTrueTypeFile( pFont ); } @@ -1880,9 +1319,7 @@ bool PrintFontManager::getMetrics( fontID nFontID, sal_Unicode minCharacter, sal ) { // might be a font not yet analyzed - if( pFont->m_eType == fonttype::Type1 ) - pFont->readAfmMetrics( m_pAtoms, false, false ); - else if( pFont->m_eType == fonttype::TrueType ) + if( pFont->m_eType == fonttype::TrueType ) analyzeTrueTypeFile( pFont ); } @@ -1930,11 +1367,9 @@ bool PrintFontManager::createFontSubset( switch( pFont->m_eType ) { case psp::fonttype::TrueType: rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF; break; - case psp::fonttype::Type1: rInfo.m_nFontType = FontSubsetInfo::ANY_TYPE1; break; default: return false; } - // TODO: remove when Type1 subsetting gets implemented if( pFont->m_eType != fonttype::TrueType ) return false; @@ -2071,8 +1506,7 @@ void PrintFontManager::getGlyphWidths( fontID nFont, std::map< sal_Unicode, sal_uInt32 >& rUnicodeEnc ) { PrintFont* pFont = getFont( nFont ); - if( !pFont || - (pFont->m_eType != fonttype::TrueType && pFont->m_eType != fonttype::Type1) ) + if( !pFont || pFont->m_eType != fonttype::TrueType ) return; if( pFont->m_eType == fonttype::TrueType ) { @@ -2131,90 +1565,6 @@ void PrintFontManager::getGlyphWidths( fontID nFont, } CloseTTFont( pTTFont ); } - else if( pFont->m_eType == fonttype::Type1 ) - { - if( pFont->m_aEncodingVector.empty() ) - pFont->readAfmMetrics( m_pAtoms, true, true ); - if( pFont->m_pMetrics ) - { - rUnicodeEnc.clear(); - rWidths.clear(); - rWidths.reserve( pFont->m_pMetrics->m_aMetrics.size() ); - for( std::unordered_map< int, CharacterMetric >::const_iterator it = - pFont->m_pMetrics->m_aMetrics.begin(); - it != pFont->m_pMetrics->m_aMetrics.end(); ++it ) - { - if( (it->first & 0x00010000) == 0 || bVertical ) - { - rUnicodeEnc[ sal_Unicode(it->first & 0x0000ffff) ] = sal_uInt32(rWidths.size()); - rWidths.push_back( it->second.width ); - } - } - } - } -} - -const std::map< sal_Unicode, sal_Int32 >* PrintFontManager::getEncodingMap( fontID nFont, const std::map< sal_Unicode, OString >** pNonEncoded, std::set<sal_Unicode> const** ppPriority ) const -{ - PrintFont* pFont = getFont( nFont ); - if( !pFont || pFont->m_eType != fonttype::Type1 ) - return nullptr; - - if( pFont->m_aEncodingVector.empty() ) - pFont->readAfmMetrics( m_pAtoms, true, true ); - - if( pNonEncoded ) - *pNonEncoded = !pFont->m_aNonEncoded.empty() ? &pFont->m_aNonEncoded : nullptr; - - if (ppPriority) - { - *ppPriority = &pFont->m_aEncodingVectorPriority; - } - - return !pFont->m_aEncodingVector.empty() ? &pFont->m_aEncodingVector : nullptr; -} - -std::list< OString > PrintFontManager::getAdobeNameFromUnicode( sal_Unicode aChar ) const -{ - std::pair< std::unordered_multimap< sal_Unicode, OString >::const_iterator, - std::unordered_multimap< sal_Unicode, OString >::const_iterator > range - = m_aUnicodeToAdobename.equal_range( aChar ); - - std::list< OString > aRet; - for( ; range.first != range.second; ++range.first ) - aRet.push_back( range.first->second ); - - if( aRet.empty() && aChar != 0 ) - { - sal_Char aBuf[8]; - sal_Int32 nChars = snprintf( - aBuf, sizeof(aBuf), "uni%.4hX", sal_uInt16(aChar)); - aRet.push_back( OString( aBuf, nChars ) ); - } - - return aRet; -} - -std::vector< sal_Unicode > PrintFontManager::getUnicodeFromAdobeName( const OString& rName ) const -{ - std::pair< std::unordered_multimap< OString, sal_Unicode, OStringHash >::const_iterator, - std::unordered_multimap< OString, sal_Unicode, OStringHash >::const_iterator > range - = m_aAdobenameToUnicode.equal_range( rName ); - - std::vector< sal_Unicode > aRet; - for( ; range.first != range.second; ++range.first ) - aRet.push_back( range.first->second ); - - if( aRet.empty() ) - { - if( rName.getLength() == 7 && rName.startsWith( "uni" ) ) - { - sal_Unicode aCode = (sal_Unicode)rName.copy( 3 ).toUInt32( 16 ); - aRet.push_back( aCode ); - } - } - - return aRet; } /// used by online unit tests via dlopen. diff --git a/vcl/unx/generic/fontmanager/parseAFM.cxx b/vcl/unx/generic/fontmanager/parseAFM.cxx deleted file mode 100644 index d933b000a43d..000000000000 --- a/vcl/unx/generic/fontmanager/parseAFM.cxx +++ /dev/null @@ -1,1465 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * (C) 1988, 1989, 1990 by Adobe Systems Incorporated. All rights reserved. - * - * This file may be freely copied and redistributed as long as: - * 1) This entire notice continues to be included in the file, - * 2) If the file has been modified in any way, a notice of such - * modification is conspicuously indicated. - * - * PostScript, Display PostScript, and Adobe are registered trademarks of - * Adobe Systems Incorporated. - * - * ************************************************************************ - * THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO CHANGE WITHOUT - * NOTICE, AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY ADOBE SYSTEMS - * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR - * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY - * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION, - * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. - * ************************************************************************ - */ - -/* - * Changes made for OpenOffice.org - * - * 10/24/2000 pl - changed code to compile with c++-compilers - * - added namespace to avoid symbol clashes - * - replaced BOOL by bool - * - added function to free space allocated by parseFile - * 10/26/2000 pl - added additional keys - * - added ability to parse slightly broken files - * - added charwidth member to GlobalFontInfo - * 04/26/2001 pl - added OpenOffice header - * 10/19/2005 pl - performance increase: - * - fread file in one pass - * - replace file io by buffer access - * 10/20/2005 pl - performance increase: - * - use one table lookup in token() routine - * instead of many conditions - * - return token length in token() routine - * - use hash lookup instead of binary search - * in recognize() routine - */ - -/* parseAFM.c - * - * This file is used in conjunction with the parseAFM.h header file. - * This file contains several procedures that are used to parse AFM - * files. It is intended to work with an application program that needs - * font metric information. The program can be used as is by making a - * procedure call to "parseFile" (passing in the expected parameters) - * and having it fill in a data structure with the data from the - * AFM file, or an application developer may wish to customize this - * code. - * - * There is also a file, parseAFMclient.c, that is a sample application - * showing how to call the "parseFile" procedure and how to use the data - * after "parseFile" has returned. - * - * Please read the comments in parseAFM.h and parseAFMclient.c. - * - * History: - * original: DSM Thu Oct 20 17:39:59 PDT 1988 - * modified: DSM Mon Jul 3 14:17:50 PDT 1989 - * - added 'storageProblem' return code - * - fixed bug of not allocating extra byte for string duplication - * - fixed typos - * modified: DSM Tue Apr 3 11:18:34 PDT 1990 - * - added free(ident) at end of parseFile routine - * modified: DSM Tue Jun 19 10:16:29 PDT 1990 - * - changed (width == 250) to (width = 250) in initializeArray - */ - -#include <string.h> -#include <stdlib.h> -#include <sys/stat.h> - -#include "parseAFM.hxx" -#include <vcl/strhelper.hxx> - -#include "rtl/alloc.h" - -#define lineterm EOL /* line terminating character */ -#define normalEOF 1 /* return code from parsing routines used only */ -/* in this module */ -#define False "false" /* used in string comparison to check the value of */ -/* boolean keys (e.g. IsFixedPitch) */ - -#define MATCH(A,B) (strncmp((A),(B), MAX_NAME) == 0) - -namespace psp { - -class FileInputStream -{ - char* m_pMemory; - unsigned int m_nPos; - unsigned int m_nLen; - public: - explicit FileInputStream( const char* pFilename ); - ~FileInputStream(); - - int getChar() { return (m_nPos < m_nLen) ? int(m_pMemory[m_nPos++]) : -1; } - void ungetChar() - { - if( m_nPos > 0 ) - m_nPos--; - } -}; - -FileInputStream::FileInputStream(const char* pFilename) - : m_pMemory(nullptr) - , m_nPos(0) - , m_nLen(0) -{ - FILE* fp = fopen( pFilename, "r" ); - if( fp ) - { - struct stat aStat; - if (!fstat(fileno(fp), &aStat) && S_ISREG(aStat.st_mode) && aStat.st_size > 0) - { - m_pMemory = static_cast<char*>(rtl_allocateMemory( aStat.st_size )); - m_nLen = (unsigned int)fread( m_pMemory, 1, aStat.st_size, fp ); - } - fclose( fp ); - } -} - -FileInputStream::~FileInputStream() -{ - rtl_freeMemory( m_pMemory ); -} - -/*************************** GLOBALS ***********************/ -/* "shorts" for fast case statement - * The values of each of these enumerated items correspond to an entry in the - * table of strings defined below. Therefore, if you add a new string as - * new keyword into the keyStrings table, you must also add a corresponding - * parseKey AND it MUST be in the same position! - * - * IMPORTANT: since the sorting algorithm is a binary search, the strings of - * keywords must be placed in lexicographical order, below. [Therefore, the - * enumerated items are not necessarily in lexicographical order, depending - * on the name chosen. BUT, they must be placed in the same position as the - * corresponding key string.] The NOPE shall remain in the last position, - * since it does not correspond to any key string, and it is used in the - * "recognize" procedure to calculate how many possible keys there are. - */ - -// some metrics have Ascent, Descent instead Ascender, Descender or Em -// which is not allowed per afm spcification, but let us handle -// this gently -enum parseKey { - ASCENDER, ASCENT, CHARBBOX, CODE, COMPCHAR, CODEHEX, CAPHEIGHT, CHARWIDTH, CHARACTERSET, CHARACTERS, COMMENT, - DESCENDER, DESCENT, EM, ENCODINGSCHEME, ENDCHARMETRICS, ENDCOMPOSITES, ENDDIRECTION, - ENDFONTMETRICS, ENDKERNDATA, ENDKERNPAIRS, ENDTRACKKERN, - FAMILYNAME, FONTBBOX, FONTNAME, FULLNAME, ISBASEFONT, ISFIXEDPITCH, - ITALICANGLE, KERNPAIR, KERNPAIRXAMT, LIGATURE, MAPPINGSCHEME, METRICSSETS, CHARNAME, - NOTICE, COMPCHARPIECE, STARTCHARMETRICS, STARTCOMPOSITES, STARTDIRECTION, - STARTFONTMETRICS, STARTKERNDATA, STARTKERNPAIRS, - STARTTRACKKERN, STDHW, STDVW, TRACKKERN, UNDERLINEPOSITION, - UNDERLINETHICKNESS, VVECTOR, VERSION, XYWIDTH, X0WIDTH, XWIDTH, WEIGHT, XHEIGHT, - NOPE -}; - -/*************************** PARSING ROUTINES **************/ - -/*************************** token *************************/ - -/* A "AFM file Conventions" tokenizer. That means that it will - * return the next token delimited by white space. See also - * the `linetoken' routine, which does a similar thing but - * reads all tokens until the next end-of-line. - */ - -// token white space is ' ', '\n', '\r', ',', '\t', ';' -static const bool is_white_Array[ 256 ] = -{ false, false, false, false, false, false, false, false, // 0-7 - false, true, true, false, false, true, false, false, // 8-15 - false, false, false, false, false, false, false, false, // 16-23 - false, false, false, false, false, false, false, false, // 24-31 - true, false, false, false, false, false, false, false, // 32-39 - false, false, false, false, true, false, false, false, // 40-47 - false, false, false, false, false, false, false, false, // 48-55 - false, false, false, true, false, false, false, false, // 56-63 - - false, false, false, false, false, false, false, false, // 64 - - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, // 127 - - false, false, false, false, false, false, false, false, // 128 - - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, // 191 - - false, false, false, false, false, false, false, false, // 192 - - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, // 255 -}; -// token delimiters are ' ', '\n', '\r', '\t', ':', ';' -static const bool is_delimiter_Array[ 256 ] = -{ false, false, false, false, false, false, false, false, // 0-7 - false, true, true, false, false, true, false, false, // 8-15 - false, false, false, false, false, false, false, false, // 16-23 - false, false, false, false, false, false, false, false, // 24-31 - true, false, false, false, false, false, false, false, // 32-39 - false, false, false, false, false, false, false, false, // 40-47 - false, false, false, false, false, false, false, false, // 48-55 - false, false, true, true, false, false, false, false, // 56-63 - - false, false, false, false, false, false, false, false, // 64 - - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, // 127 - - false, false, false, false, false, false, false, false, // 128 - - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, // 191 - - false, false, false, false, false, false, false, false, // 192 - - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, // 255 -}; -static char *token( FileInputStream* stream, int& rLen ) -{ - static char ident[MAX_NAME]; /* storage buffer for keywords */ - - int ch, idx; - - /* skip over white space */ - // relies on EOF = -1 - while( is_white_Array[ (ch = stream->getChar()) & 255 ] ) - ; - - idx = 0; - while( ch != -1 && ! is_delimiter_Array[ ch & 255 ] && idx < MAX_NAME-1 ) - { - ident[idx++] = ch; - ch = stream->getChar(); - } - - if (ch == -1 && idx < 1) return (nullptr); - if (idx >= 1 && ch != ':' && ch != -1) stream->ungetChar(); - if (idx < 1 ) ident[idx++] = ch; /* single-character token */ - ident[idx] = 0; - rLen = idx; - - return ident; /* returns pointer to the token */ - -} /* token */ - -/*************************** linetoken *************************/ - -/* "linetoken" will get read all tokens until the EOL character from - * the given stream. This is used to get any arguments that can be - * more than one word (like Comment lines and FullName). - */ - -static char *linetoken( FileInputStream* stream ) -{ - static char ident[MAX_NAME]; /* storage buffer for keywords */ - int ch, idx; - - while ((ch = stream->getChar()) == ' ' || ch == '\t' ) ; - - idx = 0; - while (ch != -1 && ch != lineterm && ch != '\r' && idx < MAX_NAME-1 ) - { - ident[idx++] = ch; - ch = stream->getChar(); - } /* while */ - - stream->ungetChar(); - ident[idx] = 0; - - return ident; /* returns pointer to the token */ - -} /* linetoken */ - -/*************************** recognize *************************/ - -/* This function tries to match a string to a known list of - * valid AFM entries (check the keyStrings array above). - * "ident" contains everything from white space through the - * next space, tab, or ":" character. - * - * The algorithm is a standard Knuth binary search. - */ -#if defined __clang__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" -#if __has_warning("-Wdeprecated-register") -#pragma GCC diagnostic ignored "-Wdeprecated-register" -#endif -#endif -#include "afm_hash.hpp" -#if defined __clang__ -#pragma GCC diagnostic pop -#endif - -static inline enum parseKey recognize( char* ident, int len) -{ - const hash_entry* pEntry = AfmKeywordHash::in_word_set( ident, len ); - return pEntry ? pEntry->eKey : NOPE; - -} /* recognize */ - -/************************* parseGlobals *****************************/ - -/* This function is called by "parseFile". It will parse the AFM file - * up to the "StartCharMetrics" keyword, which essentially marks the - * end of the Global Font Information and the beginning of the character - * metrics information. - * - * If the caller of "parseFile" specified that it wanted the Global - * Font Information (as defined by the "AFM file Specification" - * document), then that information will be stored in the returned - * data structure. - * - * Any Global Font Information entries that are not found in a - * given file, will have the usual default initialization value - * for its type (i.e. entries of type int will be 0, etc). - * - * This function returns an error code specifying whether there was - * a premature EOF or a parsing error. This return value is used by - * parseFile to determine if there is more file to parse. - */ - -static int parseGlobals( FileInputStream* fp, GlobalFontInfo* gfi ) -{ - bool cont = true, save = (gfi != nullptr); - int error = ok; - int direction = -1; - int tokenlen; - - while (cont) - { - char *keyword = token(fp, tokenlen); - - if (keyword == nullptr) - /* Have reached an early and unexpected EOF. */ - /* Set flag and stop parsing */ - { - error = earlyEOF; - break; /* get out of loop */ - } - if (!save) - /* get tokens until the end of the Global Font info section */ - /* without saving any of the data */ - switch (recognize(keyword, tokenlen)) - { - case STARTCHARMETRICS: - cont = false; - break; - case ENDFONTMETRICS: - cont = false; - error = normalEOF; - break; - default: - break; - } /* switch */ - else - /* otherwise parse entire global font info section, */ - /* saving the data */ - switch(recognize(keyword, tokenlen)) - { - case STARTFONTMETRICS: - if ((keyword = token(fp,tokenlen)) != nullptr) - gfi->afmVersion = strdup( keyword ); - break; - case COMMENT: - linetoken(fp); - break; - case FONTNAME: - if ((keyword = token(fp,tokenlen)) != nullptr) - gfi->fontName = strdup( keyword ); - break; - case ENCODINGSCHEME: - if ((keyword = token(fp,tokenlen)) != nullptr) - gfi->encodingScheme = strdup( keyword ); - break; - case FULLNAME: - if ((keyword = linetoken(fp)) != nullptr) - gfi->fullName = strdup( keyword ); - break; - case FAMILYNAME: - if ((keyword = linetoken(fp)) != nullptr) - gfi->familyName = strdup( keyword ); - break; - case WEIGHT: - if ((keyword = token(fp,tokenlen)) != nullptr) - gfi->weight = strdup( keyword ); - break; - case ITALICANGLE: - if ((keyword = token(fp,tokenlen)) != nullptr) - gfi->italicAngle = StringToDouble( keyword ); - break; - case ISFIXEDPITCH: - if ((keyword = token(fp,tokenlen)) != nullptr) - { - if (MATCH(keyword, False)) - gfi->isFixedPitch = false; - else - gfi->isFixedPitch = true; - } - break; - case UNDERLINEPOSITION: - if ((keyword = token(fp,tokenlen)) != nullptr) - gfi->underlinePosition = atoi(keyword); - break; - case UNDERLINETHICKNESS: - if ((keyword = token(fp,tokenlen)) != nullptr) - gfi->underlineThickness = atoi(keyword); - break; - case VERSION: - if ((keyword = token(fp,tokenlen)) != nullptr) - gfi->version = strdup( keyword ); - break; - case NOTICE: - if ((keyword = linetoken(fp)) != nullptr) - gfi->notice = strdup( keyword ); - break; - case FONTBBOX: - if ((keyword = token(fp,tokenlen)) != nullptr) - gfi->fontBBox.llx = atoi(keyword); - if ((keyword = token(fp,tokenlen)) != nullptr) - gfi->fontBBox.lly = atoi(keyword); - if ((keyword = token(fp,tokenlen)) != nullptr) - gfi->fontBBox.urx = atoi(keyword); - if ((keyword = token(fp,tokenlen)) != nullptr) - gfi->fontBBox.ury = atoi(keyword); - break; - case CAPHEIGHT: - if ((keyword = token(fp,tokenlen)) != nullptr) - gfi->capHeight = atoi(keyword); - break; - case XHEIGHT: - if ((keyword = token(fp,tokenlen)) != nullptr) - gfi->xHeight = atoi(keyword); - break; - case DESCENT: - if ((keyword = token(fp,tokenlen)) != nullptr) - gfi->descender = -atoi(keyword); - break; - case DESCENDER: - if ((keyword = token(fp,tokenlen)) != nullptr) - gfi->descender = atoi(keyword); - break; - case ASCENT: - case ASCENDER: - if ((keyword = token(fp,tokenlen)) != nullptr) - gfi->ascender = atoi(keyword); - break; - case STARTCHARMETRICS: - cont = false; - break; - case ENDFONTMETRICS: - cont = false; - error = normalEOF; - break; - case EM: - // skip one token - token(fp,tokenlen); - break; - case STARTDIRECTION: - if ((keyword = token(fp,tokenlen)) != nullptr) - direction = atoi(keyword); - break; /* ignore this for now */ - case ENDDIRECTION: - break; /* ignore this for now */ - case MAPPINGSCHEME: - token(fp,tokenlen); - break; /* ignore this for now */ - case CHARACTERS: - token(fp,tokenlen); - break; /* ignore this for now */ - case ISBASEFONT: - token(fp,tokenlen); - break; /* ignore this for now */ - case CHARACTERSET: - token(fp,tokenlen); //ignore - break; - case STDHW: - token(fp,tokenlen); //ignore - break; - case STDVW: - token(fp,tokenlen); //ignore - break; - case CHARWIDTH: - if ((keyword = token(fp,tokenlen)) != nullptr) - { - if (direction == 0) - gfi->charwidth = atoi(keyword); - } - token(fp,tokenlen); - /* ignore y-width for now */ - break; - case METRICSSETS: - token(fp,tokenlen); /*eat token*/ - break; /* ignore this for now */ - case NOPE: - default: - error = parseError; - break; - } /* switch */ - } /* while */ - - return error; - -} /* parseGlobals */ - -/************************* parseCharWidths **************************/ - -/* This function is called by "parseFile". It will parse the AFM file - * up to the "EndCharMetrics" keyword. It will save the character - * width info (as opposed to all of the character metric information) - * if requested by the caller of parseFile. Otherwise, it will just - * parse through the section without saving any information. - * - * If data is to be saved, parseCharWidths is passed in a pointer - * to an array of widths that has already been initialized by the - * standard value for unmapped character codes. This function parses - * the Character Metrics section only storing the width information - * for the encoded characters into the array using the character code - * as the index into that array. - * - * This function returns an error code specifying whether there was - * a premature EOF or a parsing error. This return value is used by - * parseFile to determine if there is more file to parse. - */ - -static int parseCharWidths( FileInputStream* fp, int* cwi) -{ - bool cont = true, save = (cwi != nullptr); - int pos = 0, error = ok, tokenlen; - - while (cont) - { - char *keyword = token(fp,tokenlen); - /* Have reached an early and unexpected EOF. */ - /* Set flag and stop parsing */ - if (keyword == nullptr) - { - error = earlyEOF; - break; /* get out of loop */ - } - if (!save) - /* get tokens until the end of the Char Metrics section without */ - /* saving any of the data*/ - switch (recognize(keyword,tokenlen)) - { - case ENDCHARMETRICS: - cont = false; - break; - case ENDFONTMETRICS: - cont = false; - error = normalEOF; - break; - default: - break; - } /* switch */ - else - /* otherwise parse entire char metrics section, saving */ - /* only the char x-width info */ - switch(recognize(keyword,tokenlen)) - { - case COMMENT: - linetoken(fp); /*eat token*/ - break; - case CODE: - if ((keyword = token(fp,tokenlen)) != nullptr) - pos = atoi(keyword); - break; - case XYWIDTH: - /* PROBLEM: Should be no Y-WIDTH when doing "quick & dirty" */ - token(fp,tokenlen); token(fp,tokenlen); /* eat values */ - error = parseError; - break; - case CODEHEX: - if ((keyword = token(fp,tokenlen)) != nullptr) - sscanf(keyword, "<%x>", &pos); - break; - case X0WIDTH: - (void) token(fp,tokenlen); - break; - case XWIDTH: - if ((keyword = token(fp,tokenlen)) != nullptr) - if (pos >= 0) /* ignore unmapped chars */ - cwi[pos] = atoi(keyword); - break; - case ENDCHARMETRICS: - cont = false; - break; - case ENDFONTMETRICS: - cont = false; - error = normalEOF; - break; - case CHARNAME: /* eat values (so doesn't cause parseError) */ - token(fp,tokenlen); - break; - case CHARBBOX: - token(fp,tokenlen); token(fp,tokenlen); - token(fp,tokenlen); token(fp,tokenlen); - break; - case LIGATURE: - token(fp,tokenlen); token(fp,tokenlen); - break; - case VVECTOR: - token(fp,tokenlen); /*eat token*/ - token(fp,tokenlen); /*eat token*/ - break; - case NOPE: - default: - error = parseError; - break; - } /* switch */ - } /* while */ - - return error; - -} /* parseCharWidths */ - -/* - * number of char metrics is almost always inaccurate, so be gentle and try to - * adapt our internal storage by adjusting the allocated list - */ - -static int -reallocFontMetrics( void **pp_fontmetrics, int *p_oldcount, int n_newcount, unsigned int n_size ) -{ - char *p_tmpmetrics = nullptr; - - if ((pp_fontmetrics == nullptr) || (*pp_fontmetrics == nullptr)) - return storageProblem; - - if (*p_oldcount == n_newcount) - return ok; - - p_tmpmetrics = static_cast<char*>(realloc(*pp_fontmetrics, n_newcount * n_size)); - if (p_tmpmetrics == nullptr) - return storageProblem; - - if ( n_newcount > *p_oldcount ) - { - char *p_inimetrics = p_tmpmetrics + n_size * *p_oldcount; - int n_inimetrics = n_size * (n_newcount - *p_oldcount); - memset( p_inimetrics, 0, n_inimetrics ); - } - - *pp_fontmetrics = p_tmpmetrics; - *p_oldcount = n_newcount; - - return ok; -} - -static unsigned int -enlargeCount( unsigned int n_oldcount ) -{ - unsigned int n_newcount = n_oldcount + n_oldcount / 5; - if (n_oldcount == n_newcount ) - n_newcount = n_oldcount + 5; - - return n_newcount; -} - -/************************* parseCharMetrics ************************/ - -/* This function is called by parseFile if the caller of parseFile - * requested that all character metric information be saved - * (as opposed to only the character width information). - * - * parseCharMetrics is passed in a pointer to an array of records - * to hold information on a per character basis. This function - * parses the Character Metrics section storing all character - * metric information for the ALL characters (mapped and unmapped) - * into the array. - * - * This function returns an error code specifying whether there was - * a premature EOF or a parsing error. This return value is used by - * parseFile to determine if there is more file to parse. - */ - -static int parseCharMetrics( FileInputStream* fp, FontInfo* fi) -{ - bool cont = true, firstTime = true; - int error = ok, count = 0, tokenlen; - CharMetricInfo *temp = fi->cmi; - - while (cont) - { - char *keyword = token(fp,tokenlen); - if (keyword == nullptr) - { - error = earlyEOF; - break; /* get out of loop */ - } - switch(recognize(keyword,tokenlen)) - { - case COMMENT: - linetoken(fp); /*eat token*/ - break; - case CODE: - if (!(count < fi->numOfChars)) - { - reallocFontMetrics( reinterpret_cast<void**>(&fi->cmi), - &(fi->numOfChars), enlargeCount(fi->numOfChars), - sizeof(CharMetricInfo) ); - temp = &(fi->cmi[ count - 1 ]); - } - if (count < fi->numOfChars) - { - if (firstTime) firstTime = false; - else temp++; - if ((keyword = token(fp,tokenlen)) != nullptr) - temp->code = atoi(keyword); - if (fi->gfi && fi->gfi->charwidth) - temp->wx = fi->gfi->charwidth; - count++; - } - else - { - error = parseError; - cont = false; - } - break; - case CODEHEX: - if (!(count < fi->numOfChars )) - { - reallocFontMetrics( reinterpret_cast<void**>(&fi->cmi), - &(fi->numOfChars), enlargeCount(fi->numOfChars), - sizeof(CharMetricInfo) ); - temp = &(fi->cmi[ count - 1 ]); - } - if (count < fi->numOfChars) { - if (firstTime) - firstTime = false; - else - temp++; - if ((keyword = token(fp,tokenlen)) != nullptr) - sscanf(keyword,"<%x>", &temp->code); - if (fi->gfi && fi->gfi->charwidth) - temp->wx = fi->gfi->charwidth; - count++; - } - else { - error = parseError; - cont = false; - } - break; - case XYWIDTH: - if ((keyword = token(fp,tokenlen)) != nullptr) - temp->wx = atoi(keyword); - if ((keyword = token(fp,tokenlen)) != nullptr) - temp->wy = atoi(keyword); - break; - case X0WIDTH: - if ((keyword = token(fp,tokenlen)) != nullptr) - temp->wx = atoi(keyword); - break; - case XWIDTH: - if ((keyword = token(fp,tokenlen)) != nullptr) - temp->wx = atoi(keyword); - break; - case CHARNAME: - if ((keyword = token(fp,tokenlen)) != nullptr) - temp->name = strdup(keyword); - break; - case CHARBBOX: - if ((keyword = token(fp,tokenlen)) != nullptr) - temp->charBBox.llx = atoi(keyword); - if ((keyword = token(fp,tokenlen)) != nullptr) - temp->charBBox.lly = atoi(keyword); - if ((keyword = token(fp,tokenlen)) != nullptr) - temp->charBBox.urx = atoi(keyword); - if ((keyword = token(fp,tokenlen)) != nullptr) - temp->charBBox.ury = atoi(keyword); - break; - case LIGATURE: { - Ligature **tail = &(temp->ligs); - Ligature *node = *tail; - - if (*tail != nullptr) - { - while (node->next != nullptr) - node = node->next; - tail = &(node->next); - } - - *tail = static_cast<Ligature *>(calloc(1, sizeof(Ligature))); - if ((keyword = token(fp,tokenlen)) != nullptr) - (*tail)->succ = strdup(keyword); - if ((keyword = token(fp,tokenlen)) != nullptr) - (*tail)->lig = strdup(keyword); - break; } - case ENDCHARMETRICS: - cont = false; - break; - case ENDFONTMETRICS: - cont = false; - error = normalEOF; - break; - case VVECTOR: - token(fp,tokenlen); /*eat token*/ - token(fp,tokenlen); /*eat token*/ - break; - case NOPE: - default: - error = parseError; - break; - } /* switch */ - } /* while */ - - if ((error == ok) && (count != fi->numOfChars)) - error = reallocFontMetrics( reinterpret_cast<void**>(&fi->cmi), &(fi->numOfChars), - count, sizeof(CharMetricInfo) ); - - if ((error == ok) && (count != fi->numOfChars)) - error = parseError; - - return error; - -} /* parseCharMetrics */ - -/************************* parseTrackKernData ***********************/ - -/* This function is called by "parseFile". It will parse the AFM file - * up to the "EndTrackKern" or "EndKernData" keywords. It will save the - * track kerning data if requested by the caller of parseFile. - * - * parseTrackKernData is passed in a pointer to the FontInfo record. - * If data is to be saved, the FontInfo record will already contain - * a valid pointer to storage for the track kerning data. - * - * This function returns an error code specifying whether there was - * a premature EOF or a parsing error. This return value is used by - * parseFile to determine if there is more file to parse. - */ - -static int parseTrackKernData( FileInputStream* fp, FontInfo* fi) -{ - bool cont = true, save = (fi->tkd != nullptr); - int pos = 0, error = ok, tcount = 0, tokenlen; - - while (cont) - { - char *keyword = token(fp,tokenlen); - - if (keyword == nullptr) - { - error = earlyEOF; - break; /* get out of loop */ - } - if (!save) - /* get tokens until the end of the Track Kerning Data */ - /* section without saving any of the data */ - switch(recognize(keyword,tokenlen)) - { - case ENDTRACKKERN: - case ENDKERNDATA: - cont = false; - break; - case ENDFONTMETRICS: - cont = false; - error = normalEOF; - break; - default: - break; - } /* switch */ - else - /* otherwise parse entire Track Kerning Data section, */ - /* saving the data */ - switch(recognize(keyword,tokenlen)) - { - case COMMENT: - linetoken(fp); /*eat token*/ - break; - case TRACKKERN: - if (!(tcount < fi->numOfTracks)) - { - reallocFontMetrics( reinterpret_cast<void**>(&fi->tkd), &(fi->numOfTracks), - enlargeCount(fi->numOfTracks), sizeof(TrackKernData) ); - } - - if (tcount < fi->numOfTracks) - { - if ((keyword = token(fp,tokenlen)) != nullptr) - fi->tkd[pos].degree = atoi(keyword); - if ((keyword = token(fp,tokenlen)) != nullptr) - fi->tkd[pos].minPtSize = StringToDouble(keyword); - if ((keyword = token(fp,tokenlen)) != nullptr) - fi->tkd[pos].minKernAmt = StringToDouble(keyword); - if ((keyword = token(fp,tokenlen)) != nullptr) - fi->tkd[pos].maxPtSize = StringToDouble(keyword); - if ((keyword = token(fp,tokenlen)) != nullptr) - fi->tkd[pos++].maxKernAmt = StringToDouble(keyword); - tcount++; - } - else - { - error = parseError; - cont = false; - } - break; - case ENDTRACKKERN: - case ENDKERNDATA: - cont = false; - break; - case ENDFONTMETRICS: - cont = false; - error = normalEOF; - break; - case NOPE: - default: - error = parseError; - break; - } /* switch */ - } /* while */ - - if (error == ok && tcount != fi->numOfTracks) - error = reallocFontMetrics( reinterpret_cast<void**>(&fi->tkd), &(fi->numOfTracks), - tcount, sizeof(TrackKernData) ); - - if (error == ok && tcount != fi->numOfTracks) - error = parseError; - - return error; - -} /* parseTrackKernData */ - -/************************* parsePairKernData ************************/ - -/* This function is called by "parseFile". It will parse the AFM file - * up to the "EndKernPairs" or "EndKernData" keywords. It will save - * the pair kerning data if requested by the caller of parseFile. - * - * parsePairKernData is passed in a pointer to the FontInfo record. - * If data is to be saved, the FontInfo record will already contain - * a valid pointer to storage for the pair kerning data. - * - * This function returns an error code specifying whether there was - * a premature EOF or a parsing error. This return value is used by - * parseFile to determine if there is more file to parse. - */ - -static int parsePairKernData( FileInputStream* fp, FontInfo* fi) -{ - bool cont = true, save = (fi->pkd != nullptr); - int pos = 0, error = ok, pcount = 0, tokenlen; - - while (cont) - { - char *keyword = token(fp,tokenlen); - - if (keyword == nullptr) - { - error = earlyEOF; - break; /* get out of loop */ - } - if (!save) - /* get tokens until the end of the Pair Kerning Data */ - /* section without saving any of the data */ - switch(recognize(keyword,tokenlen)) - { - case ENDKERNPAIRS: - case ENDKERNDATA: - cont = false; - break; - case ENDFONTMETRICS: - cont = false; - error = normalEOF; - break; - default: - break; - } /* switch */ - else - /* otherwise parse entire Pair Kerning Data section, */ - /* saving the data */ - switch(recognize(keyword,tokenlen)) - { - case COMMENT: - linetoken(fp); /*eat token*/ - break; - case KERNPAIR: - if (!(pcount < fi->numOfPairs)) - { - reallocFontMetrics( reinterpret_cast<void**>(&fi->pkd), &(fi->numOfPairs), - enlargeCount(fi->numOfPairs), sizeof(PairKernData) ); - } - if (pcount < fi->numOfPairs) - { - if ((keyword = token(fp,tokenlen)) != nullptr) - fi->pkd[pos].name1 = strdup( keyword ); - if ((keyword = token(fp,tokenlen)) != nullptr) - fi->pkd[pos].name2 = strdup( keyword ); - if ((keyword = token(fp,tokenlen)) != nullptr) - fi->pkd[pos].xamt = atoi(keyword); - if ((keyword = token(fp,tokenlen)) != nullptr) - fi->pkd[pos++].yamt = atoi(keyword); - pcount++; - } - else - { - error = parseError; - cont = false; - } - break; - case KERNPAIRXAMT: - if (!(pcount < fi->numOfPairs)) - { - reallocFontMetrics( reinterpret_cast<void**>(&fi->pkd), &(fi->numOfPairs), - enlargeCount(fi->numOfPairs), sizeof(PairKernData) ); - } - if (pcount < fi->numOfPairs) - { - if ((keyword = token(fp,tokenlen)) != nullptr) - fi->pkd[pos].name1 = strdup( keyword ); - if ((keyword = token(fp,tokenlen)) != nullptr) - fi->pkd[pos].name2 = strdup( keyword ); - if ((keyword = token(fp,tokenlen)) != nullptr) - fi->pkd[pos++].xamt = atoi(keyword); - pcount++; - } - else - { - error = parseError; - cont = false; - } - break; - case ENDKERNPAIRS: - case ENDKERNDATA: - cont = false; - break; - case ENDFONTMETRICS: - cont = false; - error = normalEOF; - break; - case NOPE: - default: - error = parseError; - break; - } /* switch */ - } /* while */ - - if ((error == ok) && (pcount != fi->numOfPairs)) - error = reallocFontMetrics( reinterpret_cast<void**>(&fi->pkd), &(fi->numOfPairs), - pcount, sizeof(PairKernData) ); - - if (error == ok && pcount != fi->numOfPairs) - error = parseError; - - return error; - -} /* parsePairKernData */ - -/************************* parseCompCharData **************************/ - -/* This function is called by "parseFile". It will parse the AFM file - * up to the "EndComposites" keyword. It will save the composite - * character data if requested by the caller of parseFile. - * - * parseCompCharData is passed in a pointer to the FontInfo record, and - * a boolean representing if the data should be saved. - * - * This function will create the appropriate amount of storage for - * the composite character data and store a pointer to the storage - * in the FontInfo record. - * - * This function returns an error code specifying whether there was - * a premature EOF or a parsing error. This return value is used by - * parseFile to determine if there is more file to parse. - */ - -static int parseCompCharData( FileInputStream* fp, FontInfo* fi) -{ - bool cont = true, firstTime = true, save = (fi->ccd != nullptr); - int pos = 0, j = 0, error = ok, ccount = 0, pcount = 0, tokenlen; - - while (cont) - { - char *keyword = token(fp,tokenlen); - if (keyword == nullptr) - /* Have reached an early and unexpected EOF. */ - /* Set flag and stop parsing */ - { - error = earlyEOF; - break; /* get out of loop */ - } - if (ccount > fi->numOfComps) - { - reallocFontMetrics( reinterpret_cast<void**>(&fi->ccd), &(fi->numOfComps), - enlargeCount(fi->numOfComps), sizeof(CompCharData) ); - } - if (ccount > fi->numOfComps) - { - error = parseError; - break; /* get out of loop */ - } - if (!save) - /* get tokens until the end of the Composite Character info */ - /* section without saving any of the data */ - switch(recognize(keyword,tokenlen)) - { - case ENDCOMPOSITES: - cont = false; - break; - case ENDFONTMETRICS: - cont = false; - error = normalEOF; - break; - case COMMENT: - case COMPCHAR: - linetoken(fp); - break; - default: - break; - } /* switch */ - else - /* otherwise parse entire Composite Character info section, */ - /* saving the data */ - switch(recognize(keyword,tokenlen)) - { - case COMMENT: - linetoken(fp); /*eat token*/ - break; - case COMPCHAR: - if (!(ccount < fi->numOfComps)) - { - reallocFontMetrics( reinterpret_cast<void**>(&fi->ccd), &(fi->numOfComps), - enlargeCount(fi->numOfComps), sizeof(CompCharData) ); - } - if (ccount < fi->numOfComps) - { - keyword = token(fp,tokenlen); - if (pcount != fi->ccd[pos].numOfPieces) - error = parseError; - pcount = 0; - if (firstTime) firstTime = false; - else pos++; - fi->ccd[pos].ccName = strdup( keyword ); - if ((keyword = token(fp,tokenlen)) != nullptr) - fi->ccd[pos].numOfPieces = atoi(keyword); - fi->ccd[pos].pieces = static_cast<Pcc *>( - calloc(fi->ccd[pos].numOfPieces, sizeof(Pcc))); - j = 0; - ccount++; - } - else - { - error = parseError; - cont = false; - } - break; - case COMPCHARPIECE: - if (pcount < fi->ccd[pos].numOfPieces) - { - if ((keyword = token(fp,tokenlen)) != nullptr) - fi->ccd[pos].pieces[j].pccName = strdup( keyword ); - if ((keyword = token(fp,tokenlen)) != nullptr) - fi->ccd[pos].pieces[j].deltax = atoi(keyword); - if ((keyword = token(fp,tokenlen)) != nullptr) - fi->ccd[pos].pieces[j++].deltay = atoi(keyword); - pcount++; - } - else - error = parseError; - break; - case ENDCOMPOSITES: - cont = false; - break; - case ENDFONTMETRICS: - cont = false; - error = normalEOF; - break; - case NOPE: - default: - error = parseError; - break; - } /* switch */ - } /* while */ - - if (error == ok && ccount != fi->numOfComps) - reallocFontMetrics( reinterpret_cast<void**>(&fi->ccd), &(fi->numOfComps), - ccount, sizeof(CompCharData) ); - - if (error == ok && ccount != fi->numOfComps) - error = parseError; - - return error; - -} /* parseCompCharData */ - -/*************************** 'PUBLIC' FUNCTION ********************/ - -/*************************** parseFile *****************************/ - -/* parseFile is the only 'public' procedure available. It is called - * from an application wishing to get information from an AFM file. - * The caller of this function is responsible for locating and opening - * an AFM file and handling all errors associated with that task. - * - * parseFile expects 3 parameters: a filename pointer, a pointer - * to a (FontInfo *) variable (for which storage will be allocated and - * the data requested filled in), and a mask specifying which - * data from the AFM file should be saved in the FontInfo structure. - * - * The file will be parsed and the requested data will be stored in - * a record of type FontInfo (refer to ParseAFM.h). - * - * parseFile returns an error code as defined in parseAFM.h. - * - * The position of the read/write pointer associated with the file - * pointer upon return of this function is undefined. - */ - -int parseFile( const char* pFilename, FontInfo** fi, FLAGS flags) -{ - FileInputStream aFile( pFilename ); - - int code = ok; /* return code from each of the parsing routines */ - int error = ok; /* used as the return code from this function */ - int tokenlen; - - char *keyword; /* used to store a token */ - - (*fi) = static_cast<FontInfo *>(calloc(1, sizeof(FontInfo))); - if ((*fi) == nullptr) { error = storageProblem; return error; } - - if (flags & P_G) - { - (*fi)->gfi = static_cast<GlobalFontInfo *>(calloc(1, sizeof(GlobalFontInfo))); - if ((*fi)->gfi == nullptr) { error = storageProblem; return error; } - } - - /* The AFM file begins with Global Font Information. This section */ - /* will be parsed whether or not information should be saved. */ - code = parseGlobals(&aFile, (*fi)->gfi); - - if (code < 0) error = code; - - /* The Global Font Information is followed by the Character Metrics */ - /* section. Which procedure is used to parse this section depends on */ - /* how much information should be saved. If all of the metrics info */ - /* is wanted, parseCharMetrics is called. If only the character widths */ - /* is wanted, parseCharWidths is called. parseCharWidths will also */ - /* be called in the case that no character data is to be saved, just */ - /* to parse through the section. */ - - if ((code != normalEOF) && (code != earlyEOF)) - { - if ((keyword = token(&aFile,tokenlen)) != nullptr) - (*fi)->numOfChars = atoi(keyword); - if (flags & (P_M ^ P_W)) - { - (*fi)->cmi = static_cast<CharMetricInfo *>( - calloc((*fi)->numOfChars, sizeof(CharMetricInfo))); - if ((*fi)->cmi == nullptr) { error = storageProblem; return error; } - code = parseCharMetrics(&aFile, *fi); - } - else - { - if (flags & P_W) - { - (*fi)->cwi = static_cast<int *>(calloc(256, sizeof(int))); - if ((*fi)->cwi == nullptr) - { - error = storageProblem; - return error; - } - } - /* parse section regardless */ - code = parseCharWidths(&aFile, (*fi)->cwi); - } /* else */ - } /* if */ - - if ((error != earlyEOF) && (code < 0)) error = code; - - /* The remaining sections of the AFM are optional. This code will */ - /* look at the next keyword in the file to determine what section */ - /* is next, and then allocate the appropriate amount of storage */ - /* for the data (if the data is to be saved) and call the */ - /* appropriate parsing routine to parse the section. */ - - while ((code != normalEOF) && (code != earlyEOF)) - { - keyword = token(&aFile,tokenlen); - if (keyword == nullptr) - /* Have reached an early and unexpected EOF. */ - /* Set flag and stop parsing */ - { - code = earlyEOF; - break; /* get out of loop */ - } - switch(recognize(keyword,tokenlen)) - { - case STARTKERNDATA: - break; - case ENDKERNDATA: - break; - case STARTTRACKKERN: - keyword = token(&aFile,tokenlen); - if ((flags & P_T) && keyword) - { - (*fi)->numOfTracks = atoi(keyword); - (*fi)->tkd = static_cast<TrackKernData *>( - calloc((*fi)->numOfTracks, sizeof(TrackKernData))); - if ((*fi)->tkd == nullptr) - { - error = storageProblem; - return error; - } - } /* if */ - code = parseTrackKernData(&aFile, *fi); - break; - case STARTKERNPAIRS: - keyword = token(&aFile,tokenlen); - if ((flags & P_P) && keyword) - { - (*fi)->numOfPairs = atoi(keyword); - (*fi)->pkd = static_cast<PairKernData *>( - calloc((*fi)->numOfPairs, sizeof(PairKernData))); - if ((*fi)->pkd == nullptr) - { - error = storageProblem; - return error; - } - } /* if */ - code = parsePairKernData(&aFile, *fi); - break; - case STARTCOMPOSITES: - keyword = token(&aFile,tokenlen); - if ((flags & P_C) && keyword) - { - (*fi)->numOfComps = atoi(keyword); - (*fi)->ccd = static_cast<CompCharData *>( - calloc((*fi)->numOfComps, sizeof(CompCharData))); - if ((*fi)->ccd == nullptr) - { - error = storageProblem; - return error; - } - } /* if */ - code = parseCompCharData(&aFile, *fi); - break; - case ENDFONTMETRICS: - code = normalEOF; - break; - case COMMENT: - linetoken(&aFile); - break; - case NOPE: - default: - code = parseError; - break; - } /* switch */ - - if ((error != earlyEOF) && (code < 0)) error = code; - - } /* while */ - - if ((error != earlyEOF) && (code < 0)) error = code; - - return error; - -} /* parseFile */ - -void -freeFontInfo (FontInfo *fi) -{ - int i; - - if (fi->gfi) - { - free (fi->gfi->afmVersion); - free (fi->gfi->fontName); - free (fi->gfi->fullName); - free (fi->gfi->familyName); - free (fi->gfi->weight); - free (fi->gfi->version); - free (fi->gfi->notice); - free (fi->gfi->encodingScheme); - free (fi->gfi); - } - - free (fi->cwi); - - if (fi->cmi) - { - for (i = 0; i < fi->numOfChars; i++) - { - Ligature *ligs; - free (fi->cmi[i].name); - ligs = fi->cmi[i].ligs; - while (ligs) - { - Ligature *tmp; - tmp = ligs; - ligs = ligs->next; - free (tmp->succ); - free (tmp->lig); - free (tmp); - } - } - free (fi->cmi); - } - - free (fi->tkd); - - if (fi->pkd) - { - for ( i = 0; i < fi->numOfPairs; i++) - { - free (fi->pkd[i].name1); - free (fi->pkd[i].name2); - } - free (fi->pkd); - } - - if (fi->ccd) - { - for (i = 0; i < fi->numOfComps; i++) - { - free (fi->ccd[i].ccName); - int j; - for (j = 0; j < fi->ccd[i].numOfPieces; j++) - free (fi->ccd[i].pieces[j].pccName); - - free (fi->ccd[i].pieces); - } - free (fi->ccd); - } - - free (fi); -} - -} // namspace - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/fontmanager/parseAFM.hxx b/vcl/unx/generic/fontmanager/parseAFM.hxx deleted file mode 100644 index a31217b9a14f..000000000000 --- a/vcl/unx/generic/fontmanager/parseAFM.hxx +++ /dev/null @@ -1,323 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * (C) 1988, 1989 by Adobe Systems Incorporated. All rights reserved. - * - * This file may be freely copied and redistributed as long as: - * 1) This entire notice continues to be included in the file, - * 2) If the file has been modified in any way, a notice of such - * modification is conspicuously indicated. - * - * PostScript, Display PostScript, and Adobe are registered trademarks of - * Adobe Systems Incorporated. - * - * ************************************************************************ - * THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO CHANGE WITHOUT - * NOTICE, AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY ADOBE SYSTEMS - * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR - * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY - * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION, - * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. - * ************************************************************************ - */ - -/* - * Changes made for OpenOffice.org - * - * 10/24/2000 pl - changed code to compile with c++-compilers - * - added namespace to avoid symbol clashes - * - replaced BOOL by bool - * - added function to free space allocated by parseFile - * 10/26/2000 pl - added additional keys - * - added ability to parse slightly broken files - * - added charwidth member to GlobalFontInfo - * 04/26/2001 pl - added OpenOffice header - * 10/19/2005 pl - changed parseFile to accept a file name instead of a stream - */ - -/* ParseAFM.h - * - * This header file is used in conjunction with the parseAFM.c file. - * Together these files provide the functionality to parse Adobe Font - * Metrics files and store the information in predefined data structures. - * It is intended to work with an application program that needs font metric - * information. The program can be used as is by making a procedure call to - * parse an AFM file and have the data stored, or an application developer - * may wish to customize the code. - * - * This header file defines the data structures used as well as the key - * strings that are currently recognized by this version of the AFM parser. - * This program is based on the document "Adobe Font Metrics Files, - * Specification Version 2.0". - * - * AFM files are separated into distinct sections of different data. Because - * of this, the parseAFM program can parse a specified file to only save - * certain sections of information based on the application's needs. A record - * containing the requested information will be returned to the application. - * - * AFM files are divided into five sections of data: - * 1) The Global Font Information - * 2) The Character Metrics Information - * 3) The Track Kerning Data - * 4) The Pair-Wise Kerning Data - * 5) The Composite Character Data - * - * Basically, the application can request any of these sections independent - * of what other sections are requested. In addition, in recognizing that - * many applications will want ONLY the x-width of characters and not all - * of the other character metrics information, there is a way to receive - * only the width information so as not to pay the storage cost for the - * unwanted data. An application should never request both the - * "quick and dirty" char metrics (widths only) and the Character Metrics - * Information since the Character Metrics Information will contain all - * of the character widths as well. - * - * There is a procedure in parseAFM.c, called parseFile, that can be - * called from any application wishing to get information from the AFM File. - * This procedure expects 3 parameters: a valid file descriptor, a pointer - * to a (FontInfo *) variable (for which space will be allocated and then - * will be filled in with the data requested), and a mask specifying - * which data from the AFM File should be saved in the FontInfo structure. - * - * The flags that can be used to set the appropriate mask are defined below. - * In addition, several commonly used masks have already been defined. - * - * History: - * original: DSM Thu Oct 20 17:39:59 PDT 1988 - * modified: DSM Mon Jul 3 14:17:50 PDT 1989 - * - added 'storageProblem' return code - * - fixed typos - */ - -#ifndef INCLUDED_VCL_GENERIC_FONTMANAGER_PARSEAFM_HXX -#define INCLUDED_VCL_GENERIC_FONTMANAGER_PARSEAFM_HXX - - -namespace psp { - -/* your basic constants */ -#define EOL '\n' /* end-of-line indicator */ -#define MAX_NAME 4096 /* max length for identifiers */ -#define FLAGS int - -/* Flags that can be AND'ed together to specify exactly what - * information from the AFM file should be saved. - */ -#define P_G 0x01 /* 0000 0001 */ /* Global Font Info */ -#define P_W 0x02 /* 0000 0010 */ /* Character Widths ONLY */ -#define P_M 0x06 /* 0000 0110 */ /* All Char Metric Info */ -#define P_P 0x08 /* 0000 1000 */ /* Pair Kerning Info */ -#define P_T 0x10 /* 0001 0000 */ /* Track Kerning Info */ -#define P_C 0x20 /* 0010 0000 */ /* Composite Char Info */ - -/* Commonly used flags - */ -#define P_GW (P_G | P_W) -#define P_GM (P_G | P_M) -#define P_GMP (P_G | P_M | P_P) -#define P_GMK (P_G | P_M | P_P | P_T) -#define P_ALL (P_G | P_M | P_P | P_T | P_C) - -/* Possible return codes from the parseFile procedure. - * - * ok means there were no problems parsing the file. - * - * parseError means that there was some kind of parsing error, but the - * parser went on. This could include problems like the count for any given - * section does not add up to how many entries there actually were, or - * there was a key that was not recognized. The return record may contain - * valid data or it may not. - * - * earlyEOF means that an End of File was encountered before expected. This - * may mean that the AFM file had been truncated, or improperly formed. - * - * storageProblem means that there were problems allocating storage for - * the data structures that would have contained the AFM data. - */ - -enum afmError { ok = 0, parseError = -1, earlyEOF = -2, storageProblem = -3 }; - -/************************* TYPES *********************************/ -/* Below are all of the data structure definitions. These structures - * try to map as closely as possible to grouping and naming of data - * in the AFM Files. - */ - -/* Bounding box definition. Used for the Font BBox as well as the - * Character BBox. - */ -typedef struct -{ - int llx; /* lower left x-position */ - int lly; /* lower left y-position */ - int urx; /* upper right x-position */ - int ury; /* upper right y-position */ -} BBox; - -/* Global Font information. - * The key that each field is associated with is in comments. For an - * explanation about each key and its value please refer to the AFM - * documentation (full title & version given above). - */ -typedef struct -{ - char *afmVersion; /* key: StartFontMetrics */ - char *fontName; /* key: FontName */ - char *fullName; /* key: FullName */ - char *familyName; /* key: FamilyName */ - char *weight; /* key: Weight */ - float italicAngle; /* key: ItalicAngle */ - bool isFixedPitch; /* key: IsFixedPitch */ - BBox fontBBox; /* key: FontBBox */ - int underlinePosition; /* key: UnderlinePosition */ - int underlineThickness; /* key: UnderlineThickness */ - char *version; /* key: Version */ - char *notice; /* key: Notice */ - char *encodingScheme; /* key: EncodingScheme */ - int capHeight; /* key: CapHeight */ - int xHeight; /* key: XHeight */ - int ascender; /* key: Ascender */ - int descender; /* key: Descender */ - int charwidth; /* key: CharWidth */ -} GlobalFontInfo; - -/* Ligature definition is a linked list since any character can have - * any number of ligatures. - */ -typedef struct _t_ligature -{ - char *succ, *lig; - struct _t_ligature *next; -} Ligature; - -/* Character Metric Information. This structure is used only if ALL - * character metric information is requested. If only the character - * widths is requested, then only an array of the character x-widths - * is returned. - * - * The key that each field is associated with is in comments. For an - * explanation about each key and its value please refer to the - * Character Metrics section of the AFM documentation (full title - * & version given above). - */ -typedef struct -{ - int code, /* key: C */ - wx, /* key: WX */ - wy; /* together wx and wy are associated with key: W */ - char *name; /* key: N */ - BBox charBBox; /* key: B */ - Ligature *ligs; /* key: L (linked list; not a fixed number of Ls */ -} CharMetricInfo; - -/* Track kerning data structure. - * The fields of this record are the five values associated with every - * TrackKern entry. - * - * For an explanation about each value please refer to the - * Track Kerning section of the AFM documentation (full title - * & version given above). - */ -typedef struct -{ - int degree; - float minPtSize, - minKernAmt, - maxPtSize, - maxKernAmt; -} TrackKernData; - -/* Pair Kerning data structure. - * The fields of this record are the four values associated with every - * KP entry. For KPX entries, the yamt will be zero. - * - * For an explanation about each value please refer to the - * Pair Kerning section of the AFM documentation (full title - * & version given above). - */ -typedef struct -{ - char *name1; - char *name2; - int xamt, - yamt; -} PairKernData; - -/* PCC is a piece of a composite character. This is a sub structure of a - * compCharData described below. - * These fields will be filled in with the values from the key PCC. - * - * For an explanation about each key and its value please refer to the - * Composite Character section of the AFM documentation (full title - * & version given above). - */ -typedef struct -{ - char *pccName; - int deltax, - deltay; -} Pcc; - -/* Composite Character Information data structure. - * The fields ccName and numOfPieces are filled with the values associated - * with the key CC. The field pieces points to an array (size = numOfPieces) - * of information about each of the parts of the composite character. That - * array is filled in with the values from the key PCC. - * - * For an explanation about each key and its value please refer to the - * Composite Character section of the AFM documentation (full title - * & version given above). - */ -typedef struct -{ - char *ccName; - int numOfPieces; - Pcc *pieces; -} CompCharData; - -/* FontInfo - * Record type containing pointers to all of the other data - * structures containing information about a font. - * A record of this type is filled with data by the - * parseFile function. - */ -typedef struct -{ - GlobalFontInfo *gfi; /* ptr to a GlobalFontInfo record */ - int *cwi; /* ptr to 256 element array of just char widths */ - int numOfChars; /* number of entries in char metrics array */ - CharMetricInfo *cmi; /* ptr to char metrics array */ - int numOfTracks; /* number to entries in track kerning array */ - TrackKernData *tkd; /* ptr to track kerning array */ - int numOfPairs; /* number to entries in pair kerning array */ - PairKernData *pkd; /* ptr to pair kerning array */ - int numOfComps; /* number to entries in comp char array */ - CompCharData *ccd; /* ptr to comp char array */ -} FontInfo; - -/************************* PROCEDURES ****************************/ - -/* Call this procedure to do the grunt work of parsing an AFM file. - * - * "fp" should be a valid file pointer to an AFM file. - * - * "fi" is a pointer to a pointer to a FontInfo record structure - * (defined above). Storage for the FontInfo structure will be - * allocated in parseFile and the structure will be filled in - * with the requested data from the AFM File. - * - * "flags" is a mask with bits set representing what data should - * be saved. Defined above are valid flags that can be used to set - * the mask, as well as a few commonly used masks. - * - * The possible return codes from parseFile are defined above. - */ - -int parseFile( const char* pFilename, FontInfo **fi, FLAGS flags ); -void freeFontInfo(FontInfo *fi); - -} // namespace - -#endif // INCLUDED_VCL_GENERIC_FONTMANAGER_PARSEAFM_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index 69e07a0c00c9..ea5ab47d609e 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -558,15 +558,9 @@ void CairoTextRender::FreeEmbedFontData( const void* pData, long nLen ) GenPspGraphics::DoFreeEmbedFontData( pData, nLen ); } -const Ucs2SIntMap* CairoTextRender::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const** ppPriority) +const Ucs2SIntMap* CairoTextRender::GetFontEncodingVector(const PhysicalFontFace*, const Ucs2OStrMap**, std::set<sal_Unicode> const**) { - // in this context the pFont->GetFontId() is a valid PSP - // font since they are the only ones left after the PDF - // export has filtered its list of subsettable fonts (for - // which this method was created). The correct way would - // be to have the GlyphCache search for the PhysicalFontFace pFont - psp::fontID aFont = pFont->GetFontId(); - return GenPspGraphics::DoGetFontEncodingVector(aFont, pNonEncoded, ppPriority); + return nullptr; } void CairoTextRender::GetGlyphWidths( const PhysicalFontFace* pFont, diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx index 91a363e22054..3f346b5ae344 100644 --- a/vcl/unx/generic/print/genpspgraphics.cxx +++ b/vcl/unx/generic/print/genpspgraphics.cxx @@ -948,11 +948,7 @@ bool GenPspGraphics::GetGlyphOutline( sal_GlyphId aGlyphId, SalLayout* GenPspGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLevel ) { - // workaround for printers not handling glyph indexing for non-TT fonts - int nFontId = m_pPrinterGfx->GetFontID(); - if( psp::fonttype::TrueType != psp::PrintFontManager::get().getFontType( nFontId ) ) - rArgs.mnFlags |= SalLayoutFlags::DisableGlyphProcessing; - else if( nFallbackLevel > 0 ) + if( nFallbackLevel > 0 ) rArgs.mnFlags &= ~SalLayoutFlags::DisableGlyphProcessing; GenericSalLayout* pLayout = nullptr; @@ -996,15 +992,9 @@ bool GenPspGraphics::CreateFontSubset( return bSuccess; } -const Ucs2SIntMap* GenPspGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const** ppPriority) +const Ucs2SIntMap* GenPspGraphics::GetFontEncodingVector(const PhysicalFontFace*, const Ucs2OStrMap**, std::set<sal_Unicode> const**) { - // in this context the pFont->GetFontId() is a valid PSP - // font since they are the only ones left after the PDF - // export has filtered its list of subsettable fonts (for - // which this method was created). The correct way would - // be to have the GlyphCache search for the PhysicalFontFace pFont - psp::fontID aFont = pFont->GetFontId(); - return GenPspGraphics::DoGetFontEncodingVector( aFont, pNonEncoded, ppPriority ); + return nullptr; } void GenPspGraphics::GetGlyphWidths( const PhysicalFontFace* pFont, @@ -1021,21 +1011,6 @@ void GenPspGraphics::GetGlyphWidths( const PhysicalFontFace* pFont, GenPspGraphics::DoGetGlyphWidths( aFont, bVertical, rWidths, rUnicodeEnc ); } -const Ucs2SIntMap* GenPspGraphics::DoGetFontEncodingVector( fontID aFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const** ppPriority) -{ - psp::PrintFontManager& rMgr = psp::PrintFontManager::get(); - - psp::PrintFontInfo aFontInfo; - if( ! rMgr.getFontInfo( aFont, aFontInfo ) ) - { - if( pNonEncoded ) - *pNonEncoded = nullptr; - return nullptr; - } - - return rMgr.getEncodingMap( aFont, pNonEncoded, ppPriority ); -} - void GenPspGraphics::DoGetGlyphWidths( psp::fontID aFont, bool bVertical, std::vector< sal_Int32 >& rWidths, @@ -1057,7 +1032,7 @@ FontAttributes GenPspGraphics::Info2FontAttributes( const psp::FastPrintFontInfo aDFA.SetPitch( rInfo.m_ePitch ); aDFA.SetSymbolFlag( (rInfo.m_aEncoding == RTL_TEXTENCODING_SYMBOL) ); aDFA.SetSubsettableFlag( rInfo.m_bSubsettable ); - aDFA.SetEmbeddableFlag( rInfo.m_bEmbeddable ); + aDFA.SetEmbeddableFlag(false); switch( rInfo.m_eType ) { @@ -1065,10 +1040,6 @@ FontAttributes GenPspGraphics::Info2FontAttributes( const psp::FastPrintFontInfo aDFA.SetQuality( 512 ); aDFA.SetBuiltInFontFlag( false ); break; - case psp::fonttype::Type1: - aDFA.SetQuality( 0 ); - aDFA.SetBuiltInFontFlag( false ); - break; default: aDFA.SetQuality( 0 ); aDFA.SetBuiltInFontFlag( false ); @@ -1249,13 +1220,6 @@ const void* GenPspGraphics::DoGetEmbedFontData( psp::fontID aFont, const sal_Ucs rMgr.getFontBoundingBox( aFont, xMin, yMin, xMax, yMax ); std::vector<psp::CharacterMetric> aMetrics(nLen); - sal_Ucs aUnicodes[nLen]; - if( aFontInfo.m_aEncoding == RTL_TEXTENCODING_SYMBOL && aFontInfo.m_eType == psp::fonttype::Type1 ) - { - for (size_t i = 0; i < nLen; ++i) - aUnicodes[i] = pUnicodes[i] < 0x0100 ? pUnicodes[i] + 0xf000 : pUnicodes[i]; - pUnicodes = aUnicodes; - } if (!rMgr.getMetrics(aFont, pUnicodes, nLen, aMetrics.data())) return nullptr; @@ -1287,11 +1251,6 @@ const void* GenPspGraphics::DoGetEmbedFontData( psp::fontID aFont, const sal_Ucs case psp::fonttype::TrueType: rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF; break; - case psp::fonttype::Type1: { - const bool bPFA = *static_cast<unsigned char*>(pFile) < 0x80; - rInfo.m_nFontType = bPFA ? FontSubsetInfo::TYPE1_PFA : FontSubsetInfo::TYPE1_PFB; - } - break; default: DoFreeEmbedFontData( pFile, *pDataLen ); return nullptr; diff --git a/vcl/unx/generic/print/glyphset.cxx b/vcl/unx/generic/print/glyphset.cxx index 56decb714ce9..15c0fd87d92f 100644 --- a/vcl/unx/generic/print/glyphset.cxx +++ b/vcl/unx/generic/print/glyphset.cxx @@ -53,7 +53,6 @@ GlyphSet::GlyphSet (sal_Int32 nFontID, bool bVertical) maBaseName = OUStringToOString (rMgr.getPSName(mnFontID), RTL_TEXTENCODING_ASCII_US); mnBaseEncoding = rMgr.getFontEncoding(mnFontID); - mbUseFontEncoding = rMgr.getUseOnlyFontEncoding(mnFontID); } GlyphSet::~GlyphSet () @@ -386,31 +385,6 @@ GlyphSet::GetGlyphSetEncodingName (sal_Int32 nGlyphSetID) return GetGlyphSetEncodingName (GetGlyphSetEncoding(nGlyphSetID), maBaseName); } -void -GlyphSet::PSDefineReencodedFont (osl::File* pOutFile, sal_Int32 nGlyphSetID) -{ - // only for ps fonts - if (meBaseType != fonttype::Type1) - return; - - sal_Char pEncodingVector [256]; - sal_Int32 nSize = 0; - - nSize += psp::appendStr ("(", pEncodingVector + nSize); - nSize += psp::appendStr (GetReencodedFontName(GetGlyphSetEncoding(nGlyphSetID), maBaseName).getStr(), - pEncodingVector + nSize); - nSize += psp::appendStr (") cvn (", pEncodingVector + nSize); - nSize += psp::appendStr (maBaseName.getStr(), - pEncodingVector + nSize); - nSize += psp::appendStr (") cvn ", pEncodingVector + nSize); - nSize += psp::appendStr (GetGlyphSetEncodingName(nGlyphSetID).getStr(), - pEncodingVector + nSize); - nSize += psp::appendStr (" psp_definefont\n", - pEncodingVector + nSize); - - psp::WritePS (pOutFile, pEncodingVector, nSize); -} - OString GlyphSet::GetReencodedFontName (rtl_TextEncoding nEnc, const OString &rFontName) { @@ -529,15 +503,6 @@ GlyphSet::ImplDrawText (PrinterGfx &rGfx, const Point& rPoint, { rGfx.PSMoveTo (rPoint); - if( mbUseFontEncoding ) - { - OString aPSName( OUStringToOString( rGfx.GetFontMgr().getPSName( mnFontID ), RTL_TEXTENCODING_ISO_8859_1 ) ); - OString aBytes( OUStringToOString( OUString( pStr, nLen ), mnBaseEncoding ) ); - rGfx.PSSetFont( aPSName, mnBaseEncoding ); - rGfx.PSShowText( reinterpret_cast<const unsigned char*>(aBytes.getStr()), nLen, aBytes.getLength() ); - return; - } - int nChar; unsigned char *pGlyphID = static_cast<unsigned char*>(alloca (nLen * sizeof(unsigned char))); sal_Int32 *pGlyphSetID = static_cast<sal_Int32*>(alloca (nLen * sizeof(sal_Int32))); @@ -573,105 +538,9 @@ void GlyphSet::ImplDrawText (PrinterGfx &rGfx, const Point& rPoint, const sal_Unicode* pStr, sal_Int16 nLen, const sal_Int32* pDeltaArray) { - if( mbUseFontEncoding ) - { - OString aPSName( OUStringToOString( rGfx.GetFontMgr().getPSName( mnFontID ), RTL_TEXTENCODING_ISO_8859_1 ) ); - OString aBytes( OUStringToOString( OUString( pStr, nLen ), mnBaseEncoding ) ); - rGfx.PSMoveTo( rPoint ); - rGfx.PSSetFont( aPSName, mnBaseEncoding ); - rGfx.PSShowText( reinterpret_cast<const unsigned char*>(aBytes.getStr()), nLen, aBytes.getLength(), pDeltaArray ); - return; - } - DrawGlyphs( rGfx, rPoint, nullptr, pStr, nLen, pDeltaArray, false); } -void -GlyphSet::PSUploadEncoding(osl::File* pOutFile, PrinterGfx &rGfx) -{ - // only for ps fonts - if (meBaseType != fonttype::Type1) - return; - if (mnBaseEncoding == RTL_TEXTENCODING_SYMBOL) - return; - - PrintFontManager &rMgr = rGfx.GetFontMgr(); - - // loop through all the font subsets - sal_Int32 nGlyphSetID = 0; - char_list_t::iterator aGlyphSet; - for (aGlyphSet = maCharList.begin(); aGlyphSet != maCharList.end(); ++aGlyphSet) - { - ++nGlyphSetID; - - if (nGlyphSetID == 1) // latin1 page uses global reencoding table - { - PSDefineReencodedFont (pOutFile, nGlyphSetID); - continue; - } - if ((*aGlyphSet).empty()) // empty set, doesn't need reencoding - { - continue; - } - - // create reencoding table - - sal_Char pEncodingVector [256]; - sal_Int32 nSize = 0; - - nSize += psp::appendStr ("/", - pEncodingVector + nSize); - nSize += psp::appendStr (GetGlyphSetEncodingName(nGlyphSetID).getStr(), - pEncodingVector + nSize); - nSize += psp::appendStr (" [ ", - pEncodingVector + nSize); - - // need a list of glyphs, sorted by glyphid - typedef std::map< sal_uInt8, sal_Unicode > ps_mapping_t; - typedef ps_mapping_t::value_type ps_value_t; - ps_mapping_t aSortedGlyphSet; - - char_map_t::const_iterator aUnsortedGlyph; - for (aUnsortedGlyph = (*aGlyphSet).begin(); - aUnsortedGlyph != (*aGlyphSet).end(); - ++aUnsortedGlyph) - { - aSortedGlyphSet.insert(ps_value_t((*aUnsortedGlyph).second, - (*aUnsortedGlyph).first)); - } - - ps_mapping_t::const_iterator aSortedGlyph; - // loop through all the glyphs in the subset - for (aSortedGlyph = (aSortedGlyphSet).begin(); - aSortedGlyph != (aSortedGlyphSet).end(); - ++aSortedGlyph) - { - nSize += psp::appendStr ("/", - pEncodingVector + nSize); - - std::list< OString > aName( rMgr.getAdobeNameFromUnicode((*aSortedGlyph).second) ); - - if( !aName.empty() ) - nSize += psp::appendStr ( aName.front().getStr(), pEncodingVector + nSize); - else - nSize += psp::appendStr (".notdef", pEncodingVector + nSize ); - nSize += psp::appendStr (" ", pEncodingVector + nSize); - // flush line - if (nSize >= 70) - { - psp::appendStr ("\n", pEncodingVector + nSize); - psp::WritePS (pOutFile, pEncodingVector); - nSize = 0; - } - } - - nSize += psp::appendStr ("] def\n", pEncodingVector + nSize); - psp::WritePS (pOutFile, pEncodingVector, nSize); - - PSDefineReencodedFont (pOutFile, nGlyphSetID); - } -} - struct EncEntry { unsigned char aEnc; diff --git a/vcl/unx/generic/print/glyphset.hxx b/vcl/unx/generic/print/glyphset.hxx index dfe17ce43864..d807af45dbef 100644 --- a/vcl/unx/generic/print/glyphset.hxx +++ b/vcl/unx/generic/print/glyphset.hxx @@ -45,7 +45,6 @@ private: OString maBaseName; fonttype::type meBaseType; rtl_TextEncoding mnBaseEncoding; - bool mbUseFontEncoding; typedef std::unordered_map< sal_Unicode, sal_uInt8 > char_map_t; typedef std::list< char_map_t > char_list_t; @@ -60,9 +59,6 @@ private: sal_Int32 GetGlyphSetEncoding (sal_Int32 nGlyphSetID); OString GetGlyphSetEncodingName (sal_Int32 nGlyphSetID); - void PSDefineReencodedFont (osl::File* pOutFile, - sal_Int32 nGlyphSetID); - bool GetCharID (sal_Unicode nChar, unsigned char* nOutGlyphID, sal_Int32* nOutGlyphSetID); bool LookupCharID (sal_Unicode nChar, @@ -113,7 +109,6 @@ public: sal_Int16 nLen, const sal_Int32* pDeltaArray, bool bUseGlyphs=true); - void PSUploadEncoding(osl::File* pOutFile, PrinterGfx &rGfx); void PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAsType42, std::list< OString >& rSuppliedFonts ); }; diff --git a/vcl/unx/generic/print/text_gfx.cxx b/vcl/unx/generic/print/text_gfx.cxx index bcb46583a8ae..bf4d4a830520 100644 --- a/vcl/unx/generic/print/text_gfx.cxx +++ b/vcl/unx/generic/print/text_gfx.cxx @@ -82,19 +82,6 @@ static int getVerticalDeltaAngle( sal_Unicode nChar ) return 0; } -void -PrinterGfx::PSUploadPS1Font (sal_Int32 nFontID) -{ - // already in the document header ? - for ( int i : maPS1Font ) - if( nFontID == i ) - return; - - // no occurrence yet, mark for download - // add the fontid to the list - maPS1Font.push_back (nFontID); -} - /* * implement text handling printer routines, */ @@ -167,12 +154,6 @@ void PrinterGfx::DrawGlyphs( return; } - if( mrFontMgr.getFontType( mnFontID ) != fonttype::TrueType ) - { - DrawText( rPoint, pUnicodes, nLen, pDeltaArray ); - return; - } - // move and rotate the user coordinate system // avoid the gsave/grestore for the simple cases since it allows // reuse of the current font if it hasn't changed @@ -559,9 +540,6 @@ PrinterGfx::drawText( fonttype::type eType = mrFontMgr.getFontType (mnFontID); - if (eType == fonttype::Type1) - PSUploadPS1Font (mnFontID); - if ( eType == fonttype::TrueType && !mrFontMgr.isFontDownloadingAllowedForPrinting(mnFontID)) { @@ -569,13 +547,6 @@ PrinterGfx::drawText( return; } - if( mrFontMgr.getUseOnlyFontEncoding( mnFontID ) ) - { - GlyphSet aGSet( mnFontID, mbTextVertical ); - aGSet.DrawText( *this, rPoint, pStr, nLen, pDeltaArray ); - return; - } - // search for a glyph set matching the set font std::list< GlyphSet >::iterator aIter; for (aIter = maPS3Font.begin(); aIter != maPS3Font.end(); ++aIter) @@ -656,51 +627,11 @@ void PrinterGfx::OnEndJob () { maPS3Font.clear(); - maPS1Font.clear(); } void PrinterGfx::writeResources( osl::File* pFile, std::list< OString >& rSuppliedFonts ) { - // write all type 1 fonts - // already in the document header ? - for (int aFont : maPS1Font) - { - const OString& rSysPath (mrFontMgr.getFontFileSysPath(aFont) ); - OUString aUNCPath; - osl::File::getFileURLFromSystemPath (OStringToOUString (rSysPath, osl_getThreadTextEncoding()), aUNCPath); - osl::File aFontFile (aUNCPath); - - // provide the pfb or pfa font as a (pfa-)font resource - OString aPostScriptName = - OUStringToOString ( mrFontMgr.getPSName(aFont), - RTL_TEXTENCODING_ASCII_US ); - - WritePS (pFile, "%%BeginResource: font "); - WritePS (pFile, aPostScriptName.getStr()); - WritePS (pFile, "\n"); - - osl::File::RC nError = aFontFile.open(osl_File_OpenFlag_Read); - if (nError == osl::File::E_None) - { - convertPfbToPfa (aFontFile, *pFile); - aFontFile.close (); - - char lastchar = '\n'; - - if (pFile->setPos(osl_Pos_Current, -1) == osl::FileBase::E_None) - { - sal_uInt64 uBytes(1); - pFile->read(static_cast<void *>(&lastchar), uBytes, uBytes); - } - - if (lastchar != '\n') - WritePS (pFile, "\n"); - } - WritePS (pFile, "%%EndResource\n"); - rSuppliedFonts.push_back( aPostScriptName ); - } - // write glyphsets and reencodings std::list< GlyphSet >::iterator aIter; for (aIter = maPS3Font.begin(); aIter != maPS3Font.end(); ++aIter) @@ -709,10 +640,6 @@ PrinterGfx::writeResources( osl::File* pFile, std::list< OString >& rSuppliedFon { aIter->PSUploadFont (*pFile, *this, mbUploadPS42Fonts, rSuppliedFonts ); } - else - { - aIter->PSUploadEncoding (pFile, *this); - } } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |