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