1ebfcd9afSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3ebfcd9afSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4ebfcd9afSAndrew Rist * or more contributor license agreements. See the NOTICE file 5ebfcd9afSAndrew Rist * distributed with this work for additional information 6ebfcd9afSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7ebfcd9afSAndrew Rist * to you under the Apache License, Version 2.0 (the 8ebfcd9afSAndrew Rist * "License"); you may not use this file except in compliance 9ebfcd9afSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11ebfcd9afSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13ebfcd9afSAndrew Rist * Unless required by applicable law or agreed to in writing, 14ebfcd9afSAndrew Rist * software distributed under the License is distributed on an 15ebfcd9afSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16ebfcd9afSAndrew Rist * KIND, either express or implied. See the License for the 17ebfcd9afSAndrew Rist * specific language governing permissions and limitations 18ebfcd9afSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20ebfcd9afSAndrew Rist *************************************************************/ 21ebfcd9afSAndrew Rist 22ebfcd9afSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _PSPRINT_GLYPHSET_HXX_ 25cdf0e10cSrcweir #define _PSPRINT_GLYPHSET_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "vcl/fontmanager.hxx" 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include "osl/file.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include "rtl/string.hxx" 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include "tools/gen.hxx" 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include <list> 36cdf0e10cSrcweir #include <hash_map> 37cdf0e10cSrcweir 38cdf0e10cSrcweir namespace psp { 39cdf0e10cSrcweir 40cdf0e10cSrcweir class PrinterGfx; 41cdf0e10cSrcweir class PrintFontManager; 42cdf0e10cSrcweir 43cdf0e10cSrcweir class GlyphSet 44cdf0e10cSrcweir { 45cdf0e10cSrcweir private: 46cdf0e10cSrcweir 47cdf0e10cSrcweir sal_Int32 mnFontID; 48cdf0e10cSrcweir sal_Bool mbVertical; 49cdf0e10cSrcweir rtl::OString maBaseName; 50cdf0e10cSrcweir fonttype::type meBaseType; 51cdf0e10cSrcweir rtl_TextEncoding mnBaseEncoding; 52cdf0e10cSrcweir bool mbUseFontEncoding; 53cdf0e10cSrcweir 54cdf0e10cSrcweir typedef std::hash_map< sal_Unicode, sal_uInt8 > char_map_t; 55cdf0e10cSrcweir typedef std::list< char_map_t > char_list_t; 56*248a599fSHerbert Dürr typedef std::hash_map< sal_GlyphId, sal_uInt8 > glyph_map_t; 57cdf0e10cSrcweir typedef std::list< glyph_map_t > glyph_list_t; 58cdf0e10cSrcweir 59cdf0e10cSrcweir char_list_t maCharList; 60cdf0e10cSrcweir glyph_list_t maGlyphList; 61cdf0e10cSrcweir 62cdf0e10cSrcweir rtl::OString GetGlyphSetName (sal_Int32 nGlyphSetID); 63cdf0e10cSrcweir rtl::OString GetCharSetName (sal_Int32 nGlyphSetID); 64cdf0e10cSrcweir sal_Int32 GetGlyphSetEncoding (sal_Int32 nGlyphSetID); 65cdf0e10cSrcweir rtl::OString GetGlyphSetEncodingName (sal_Int32 nGlyphSetID); 66cdf0e10cSrcweir 67cdf0e10cSrcweir rtl::OString GetReencodedFontName (sal_Int32 nGlyphSetID); 68cdf0e10cSrcweir void PSDefineReencodedFont (osl::File* pOutFile, 69cdf0e10cSrcweir sal_Int32 nGlyphSetID); 70cdf0e10cSrcweir 71cdf0e10cSrcweir sal_Bool GetCharID (sal_Unicode nChar, 72cdf0e10cSrcweir sal_uChar* nOutGlyphID, sal_Int32* nOutGlyphSetID); 73cdf0e10cSrcweir sal_Bool LookupCharID (sal_Unicode nChar, 74cdf0e10cSrcweir sal_uChar* nOutGlyphID, sal_Int32* nOutGlyphSetID); 75cdf0e10cSrcweir sal_Bool AddCharID (sal_Unicode nChar, 76cdf0e10cSrcweir sal_uChar* nOutGlyphID, 77cdf0e10cSrcweir sal_Int32* nOutGlyphSetID); 78*248a599fSHerbert Dürr sal_Bool GetGlyphID( sal_GlyphId nGlyphId, sal_Unicode nUnicode, 79cdf0e10cSrcweir sal_uChar* nOutGlyphID, sal_Int32* nOutGlyphSetID); 80*248a599fSHerbert Dürr sal_Bool LookupGlyphID( sal_GlyphId nGlyphId, 81cdf0e10cSrcweir sal_uChar* nOutGlyphID, sal_Int32* nOutGlyphSetID); 82*248a599fSHerbert Dürr sal_Bool AddGlyphID (sal_GlyphId nGlyphId, sal_Unicode nUnicode, 83cdf0e10cSrcweir sal_uChar* nOutGlyphID, 84cdf0e10cSrcweir sal_Int32* nOutGlyphSetID); 85cdf0e10cSrcweir void AddNotdef (char_map_t &rCharMap); 86cdf0e10cSrcweir void AddNotdef (glyph_map_t &rGlyphMap); 87cdf0e10cSrcweir sal_uChar GetAnsiMapping (sal_Unicode nUnicodeChar); 88cdf0e10cSrcweir sal_uChar GetSymbolMapping (sal_Unicode nUnicodeChar); 89cdf0e10cSrcweir 90cdf0e10cSrcweir void ImplDrawText (PrinterGfx &rGfx, const Point& rPoint, 91cdf0e10cSrcweir const sal_Unicode* pStr, sal_Int16 nLen); 92cdf0e10cSrcweir void ImplDrawText (PrinterGfx &rGfx, const Point& rPoint, 93cdf0e10cSrcweir const sal_Unicode* pStr, sal_Int16 nLen, 94cdf0e10cSrcweir const sal_Int32* pDeltaArray); 95cdf0e10cSrcweir 96cdf0e10cSrcweir public: 97cdf0e10cSrcweir 98cdf0e10cSrcweir GlyphSet (); 99cdf0e10cSrcweir GlyphSet (sal_Int32 nFontID, sal_Bool bVertical); 100cdf0e10cSrcweir ~GlyphSet (); 101cdf0e10cSrcweir 102cdf0e10cSrcweir sal_Int32 GetFontID (); 103cdf0e10cSrcweir fonttype::type GetFontType (); 104cdf0e10cSrcweir static rtl::OString 105cdf0e10cSrcweir GetReencodedFontName (rtl_TextEncoding nEnc, 106cdf0e10cSrcweir const rtl::OString &rFontName); 107cdf0e10cSrcweir static rtl::OString 108cdf0e10cSrcweir GetGlyphSetEncodingName (rtl_TextEncoding nEnc, 109cdf0e10cSrcweir const rtl::OString &rFontName); 110cdf0e10cSrcweir sal_Bool IsVertical (); 111cdf0e10cSrcweir 112cdf0e10cSrcweir sal_Bool SetFont (sal_Int32 nFontID, sal_Bool bVertical); 113cdf0e10cSrcweir 114cdf0e10cSrcweir void DrawText (PrinterGfx &rGfx, const Point& rPoint, 115cdf0e10cSrcweir const sal_Unicode* pStr, sal_Int16 nLen, 116cdf0e10cSrcweir const sal_Int32* pDeltaArray = NULL); 117cdf0e10cSrcweir void DrawGlyphs (PrinterGfx& rGfx, 118cdf0e10cSrcweir const Point& rPoint, 119*248a599fSHerbert Dürr const sal_GlyphId* pGlyphIds, 120cdf0e10cSrcweir const sal_Unicode* pUnicodes, 121cdf0e10cSrcweir sal_Int16 nLen, 122cdf0e10cSrcweir const sal_Int32* pDeltaArray ); 123cdf0e10cSrcweir sal_Bool PSUploadEncoding(osl::File* pOutFile, PrinterGfx &rGfx); 124cdf0e10cSrcweir sal_Bool PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAsType42, std::list< rtl::OString >& rSuppliedFonts ); 125cdf0e10cSrcweir }; 126cdf0e10cSrcweir 127cdf0e10cSrcweir 128cdf0e10cSrcweir } /* namespace psp */ 129cdf0e10cSrcweir 130cdf0e10cSrcweir #endif 131cdf0e10cSrcweir 132