Branch libreoffice-5-0-4
[LibreOffice.git] / vcl / generic / print / glyphset.hxx
blob1d8a4612fb4fbf9958c9b749f2fd65545589c840
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_GENERIC_PRINT_GLYPHSET_HXX
21 #define INCLUDED_VCL_GENERIC_PRINT_GLYPHSET_HXX
23 #include "fontmanager.hxx"
25 #include "osl/file.hxx"
27 #include "rtl/string.hxx"
29 #include <list>
30 #include <unordered_map>
32 class Point;
34 namespace psp {
36 class PrinterGfx;
37 class PrintFontManager;
39 class GlyphSet
41 private:
43 sal_Int32 mnFontID;
44 bool mbVertical;
45 OString maBaseName;
46 fonttype::type meBaseType;
47 rtl_TextEncoding mnBaseEncoding;
48 bool mbUseFontEncoding;
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;
55 char_list_t maCharList;
56 glyph_list_t maGlyphList;
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);
63 OString GetReencodedFontName (sal_Int32 nGlyphSetID);
64 void PSDefineReencodedFont (osl::File* pOutFile,
65 sal_Int32 nGlyphSetID);
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);
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);
92 public:
94 GlyphSet (sal_Int32 nFontID, bool bVertical);
95 ~GlyphSet ();
97 sal_Int32 GetFontID () { return mnFontID;}
98 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 bool IsVertical () { return mbVertical;}
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 );
121 } /* namespace psp */
123 #endif
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */