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 INCLUDED_VCL_GENERIC_PRINT_GLYPHSET_HXX
21 : #define INCLUDED_VCL_GENERIC_PRINT_GLYPHSET_HXX
22 :
23 : #include "fontmanager.hxx"
24 :
25 : #include "osl/file.hxx"
26 :
27 : #include "rtl/string.hxx"
28 :
29 : #include <list>
30 : #include <unordered_map>
31 :
32 : class Point;
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 : bool mbVertical;
45 : OString maBaseName;
46 : fonttype::type meBaseType;
47 : rtl_TextEncoding mnBaseEncoding;
48 : bool mbUseFontEncoding;
49 :
50 : typedef std::unordered_map< sal_Unicode, sal_uInt8 > char_map_t;
51 : typedef std::list< char_map_t > char_list_t;
52 : typedef std::unordered_map< sal_GlyphId, 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 : OString GetGlyphSetName (sal_Int32 nGlyphSetID);
59 : OString GetCharSetName (sal_Int32 nGlyphSetID);
60 : sal_Int32 GetGlyphSetEncoding (sal_Int32 nGlyphSetID);
61 : OString GetGlyphSetEncodingName (sal_Int32 nGlyphSetID);
62 :
63 : OString GetReencodedFontName (sal_Int32 nGlyphSetID);
64 : void PSDefineReencodedFont (osl::File* pOutFile,
65 : sal_Int32 nGlyphSetID);
66 :
67 : bool GetCharID (sal_Unicode nChar,
68 : unsigned char* nOutGlyphID, sal_Int32* nOutGlyphSetID);
69 : bool LookupCharID (sal_Unicode nChar,
70 : unsigned char* nOutGlyphID, sal_Int32* nOutGlyphSetID);
71 : bool AddCharID (sal_Unicode nChar,
72 : unsigned char* nOutGlyphID,
73 : sal_Int32* nOutGlyphSetID);
74 : bool GetGlyphID (sal_GlyphId nGlyphId, sal_Unicode nUnicode,
75 : unsigned char* nOutGlyphID, sal_Int32* nOutGlyphSetID);
76 : bool LookupGlyphID (sal_GlyphId nGlyphId,
77 : unsigned char* nOutGlyphID, sal_Int32* nOutGlyphSetID);
78 : bool AddGlyphID (sal_GlyphId nGlyphId, sal_Unicode nUnicode,
79 : unsigned char* nOutGlyphID,
80 : sal_Int32* nOutGlyphSetID);
81 : static void AddNotdef (char_map_t &rCharMap);
82 : static void AddNotdef (glyph_map_t &rGlyphMap);
83 : static unsigned char GetAnsiMapping (sal_Unicode nUnicodeChar);
84 : static unsigned char 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, bool bVertical);
95 : ~GlyphSet ();
96 :
97 0 : sal_Int32 GetFontID () { return mnFontID;}
98 0 : fonttype::type GetFontType () { return meBaseType;}
99 : static OString
100 : GetReencodedFontName (rtl_TextEncoding nEnc,
101 : const OString &rFontName);
102 : static OString
103 : GetGlyphSetEncodingName (rtl_TextEncoding nEnc,
104 : const OString &rFontName);
105 0 : bool IsVertical () { return mbVertical;}
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_GlyphId* pGlyphIds,
113 : const sal_Unicode* pUnicodes,
114 : sal_Int16 nLen,
115 : const sal_Int32* pDeltaArray,
116 : bool bUseGlyphs=true);
117 : bool PSUploadEncoding(osl::File* pOutFile, PrinterGfx &rGfx);
118 : bool PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAsType42, std::list< OString >& rSuppliedFonts );
119 : };
120 :
121 : } /* namespace psp */
122 :
123 : #endif
124 :
125 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|