Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _PSPRINT_GLYPHSET_HXX_
21 : #define _PSPRINT_GLYPHSET_HXX_
22 :
23 : #include "vcl/fontmanager.hxx"
24 :
25 : #include "osl/file.hxx"
26 :
27 : #include "rtl/string.hxx"
28 :
29 : #include "tools/gen.hxx"
30 :
31 : #include <list>
32 : #include <boost/unordered_map.hpp>
33 :
34 : namespace psp {
35 :
36 : class PrinterGfx;
37 : class PrintFontManager;
38 :
39 0 : class GlyphSet
40 : {
41 : private:
42 :
43 : sal_Int32 mnFontID;
44 : sal_Bool mbVertical;
45 : rtl::OString maBaseName;
46 : fonttype::type meBaseType;
47 : rtl_TextEncoding mnBaseEncoding;
48 : bool mbUseFontEncoding;
49 :
50 : typedef boost::unordered_map< sal_Unicode, sal_uInt8 > char_map_t;
51 : typedef std::list< char_map_t > char_list_t;
52 : typedef boost::unordered_map< sal_uInt32, sal_uInt8 > glyph_map_t;
53 : typedef std::list< glyph_map_t > glyph_list_t;
54 :
55 : char_list_t maCharList;
56 : glyph_list_t maGlyphList;
57 :
58 : rtl::OString GetGlyphSetName (sal_Int32 nGlyphSetID);
59 : rtl::OString GetCharSetName (sal_Int32 nGlyphSetID);
60 : sal_Int32 GetGlyphSetEncoding (sal_Int32 nGlyphSetID);
61 : rtl::OString GetGlyphSetEncodingName (sal_Int32 nGlyphSetID);
62 :
63 : rtl::OString GetReencodedFontName (sal_Int32 nGlyphSetID);
64 : void PSDefineReencodedFont (osl::File* pOutFile,
65 : sal_Int32 nGlyphSetID);
66 :
67 : sal_Bool GetCharID (sal_Unicode nChar,
68 : sal_uChar* nOutGlyphID, sal_Int32* nOutGlyphSetID);
69 : sal_Bool LookupCharID (sal_Unicode nChar,
70 : sal_uChar* nOutGlyphID, sal_Int32* nOutGlyphSetID);
71 : sal_Bool AddCharID (sal_Unicode nChar,
72 : sal_uChar* nOutGlyphID,
73 : sal_Int32* nOutGlyphSetID);
74 : sal_Bool GetGlyphID (sal_uInt32 nGlyph, sal_Unicode nUnicode,
75 : sal_uChar* nOutGlyphID, sal_Int32* nOutGlyphSetID);
76 : sal_Bool LookupGlyphID (sal_uInt32 nGlyph,
77 : sal_uChar* nOutGlyphID, sal_Int32* nOutGlyphSetID);
78 : sal_Bool AddGlyphID (sal_uInt32 nGlyph, sal_Unicode nUnicode,
79 : sal_uChar* nOutGlyphID,
80 : sal_Int32* nOutGlyphSetID);
81 : void AddNotdef (char_map_t &rCharMap);
82 : void AddNotdef (glyph_map_t &rGlyphMap);
83 : sal_uChar GetAnsiMapping (sal_Unicode nUnicodeChar);
84 : sal_uChar GetSymbolMapping (sal_Unicode nUnicodeChar);
85 :
86 : void ImplDrawText (PrinterGfx &rGfx, const Point& rPoint,
87 : const sal_Unicode* pStr, sal_Int16 nLen);
88 : void ImplDrawText (PrinterGfx &rGfx, const Point& rPoint,
89 : const sal_Unicode* pStr, sal_Int16 nLen,
90 : const sal_Int32* pDeltaArray);
91 :
92 : public:
93 :
94 : GlyphSet (sal_Int32 nFontID, sal_Bool bVertical);
95 : ~GlyphSet ();
96 :
97 : sal_Int32 GetFontID ();
98 : fonttype::type GetFontType ();
99 : static rtl::OString
100 : GetReencodedFontName (rtl_TextEncoding nEnc,
101 : const rtl::OString &rFontName);
102 : static rtl::OString
103 : GetGlyphSetEncodingName (rtl_TextEncoding nEnc,
104 : const rtl::OString &rFontName);
105 : sal_Bool IsVertical ();
106 :
107 : void DrawText (PrinterGfx &rGfx, const Point& rPoint,
108 : const sal_Unicode* pStr, sal_Int16 nLen,
109 : const sal_Int32* pDeltaArray = NULL);
110 : void DrawGlyphs (PrinterGfx& rGfx,
111 : const Point& rPoint,
112 : const sal_uInt32* pGlyphIds,
113 : const sal_Unicode* pUnicodes,
114 : sal_Int16 nLen,
115 : const sal_Int32* pDeltaArray,
116 : sal_Bool bUseGlyphs=sal_True);
117 : sal_Bool PSUploadEncoding(osl::File* pOutFile, PrinterGfx &rGfx);
118 : sal_Bool PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAsType42, std::list< rtl::OString >& rSuppliedFonts );
119 : };
120 :
121 :
122 : } /* namespace psp */
123 :
124 : #endif
125 :
126 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|