1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _PSPRINT_GLYPHSET_HXX_ 29 #define _PSPRINT_GLYPHSET_HXX_ 30 31 #include "vcl/fontmanager.hxx" 32 33 #include "osl/file.hxx" 34 35 #include "rtl/string.hxx" 36 37 #include "tools/gen.hxx" 38 39 #include <list> 40 #include <hash_map> 41 42 namespace psp { 43 44 class PrinterGfx; 45 class PrintFontManager; 46 47 class GlyphSet 48 { 49 private: 50 51 sal_Int32 mnFontID; 52 sal_Bool mbVertical; 53 rtl::OString maBaseName; 54 fonttype::type meBaseType; 55 rtl_TextEncoding mnBaseEncoding; 56 bool mbUseFontEncoding; 57 58 typedef std::hash_map< sal_Unicode, sal_uInt8 > char_map_t; 59 typedef std::list< char_map_t > char_list_t; 60 typedef std::hash_map< sal_uInt32, sal_uInt8 > glyph_map_t; 61 typedef std::list< glyph_map_t > glyph_list_t; 62 63 char_list_t maCharList; 64 glyph_list_t maGlyphList; 65 66 rtl::OString GetGlyphSetName (sal_Int32 nGlyphSetID); 67 rtl::OString GetCharSetName (sal_Int32 nGlyphSetID); 68 sal_Int32 GetGlyphSetEncoding (sal_Int32 nGlyphSetID); 69 rtl::OString GetGlyphSetEncodingName (sal_Int32 nGlyphSetID); 70 71 rtl::OString GetReencodedFontName (sal_Int32 nGlyphSetID); 72 void PSDefineReencodedFont (osl::File* pOutFile, 73 sal_Int32 nGlyphSetID); 74 75 sal_Bool GetCharID (sal_Unicode nChar, 76 sal_uChar* nOutGlyphID, sal_Int32* nOutGlyphSetID); 77 sal_Bool LookupCharID (sal_Unicode nChar, 78 sal_uChar* nOutGlyphID, sal_Int32* nOutGlyphSetID); 79 sal_Bool AddCharID (sal_Unicode nChar, 80 sal_uChar* nOutGlyphID, 81 sal_Int32* nOutGlyphSetID); 82 sal_Bool GetGlyphID (sal_uInt32 nGlyph, sal_Unicode nUnicode, 83 sal_uChar* nOutGlyphID, sal_Int32* nOutGlyphSetID); 84 sal_Bool LookupGlyphID (sal_uInt32 nGlyph, 85 sal_uChar* nOutGlyphID, sal_Int32* nOutGlyphSetID); 86 sal_Bool AddGlyphID (sal_uInt32 nGlyph, sal_Unicode nUnicode, 87 sal_uChar* nOutGlyphID, 88 sal_Int32* nOutGlyphSetID); 89 void AddNotdef (char_map_t &rCharMap); 90 void AddNotdef (glyph_map_t &rGlyphMap); 91 sal_uChar GetAnsiMapping (sal_Unicode nUnicodeChar); 92 sal_uChar GetSymbolMapping (sal_Unicode nUnicodeChar); 93 94 void ImplDrawText (PrinterGfx &rGfx, const Point& rPoint, 95 const sal_Unicode* pStr, sal_Int16 nLen); 96 void ImplDrawText (PrinterGfx &rGfx, const Point& rPoint, 97 const sal_Unicode* pStr, sal_Int16 nLen, 98 const sal_Int32* pDeltaArray); 99 100 public: 101 102 GlyphSet (); 103 GlyphSet (sal_Int32 nFontID, sal_Bool bVertical); 104 ~GlyphSet (); 105 106 sal_Int32 GetFontID (); 107 fonttype::type GetFontType (); 108 static rtl::OString 109 GetReencodedFontName (rtl_TextEncoding nEnc, 110 const rtl::OString &rFontName); 111 static rtl::OString 112 GetGlyphSetEncodingName (rtl_TextEncoding nEnc, 113 const rtl::OString &rFontName); 114 sal_Bool IsVertical (); 115 116 sal_Bool SetFont (sal_Int32 nFontID, sal_Bool bVertical); 117 118 void DrawText (PrinterGfx &rGfx, const Point& rPoint, 119 const sal_Unicode* pStr, sal_Int16 nLen, 120 const sal_Int32* pDeltaArray = NULL); 121 void DrawGlyphs (PrinterGfx& rGfx, 122 const Point& rPoint, 123 const sal_uInt32* pGlyphIds, 124 const sal_Unicode* pUnicodes, 125 sal_Int16 nLen, 126 const sal_Int32* pDeltaArray ); 127 sal_Bool PSUploadEncoding(osl::File* pOutFile, PrinterGfx &rGfx); 128 sal_Bool PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAsType42, std::list< rtl::OString >& rSuppliedFonts ); 129 }; 130 131 132 } /* namespace psp */ 133 134 #endif 135 136