bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / vcl / fontcharmap.hxx
blob2a4e1dd08ff1c587a01a07d0dcbdf3b04b7baed2
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_FONTCHARMAP_HXX
21 #define INCLUDED_FONTCHARMAP_HXX
23 #include <vcl/dllapi.h>
24 #include <tools/ref.hxx>
26 class ImplFontCharMap;
27 class CmapResult;
28 class FontCharMap;
29 class OutputDevice;
31 typedef sal_uInt32 sal_UCS4;
32 typedef tools::SvRef<ImplFontCharMap> ImplFontCharMapRef;
33 typedef tools::SvRef<FontCharMap> FontCharMapRef;
35 class VCL_DLLPUBLIC FontCharMap : public SvRefBase
37 public:
38 /** A new FontCharMap is created based on a "default" map, which includes
39 all codepoints in the Unicode BMP range, including surrogates.
40 **/
41 FontCharMap();
42 FontCharMap( const CmapResult& rCR );
43 virtual ~FontCharMap() override;
45 /** Get the default font character map
47 @returns the default font character map.
49 static FontCharMapRef GetDefaultMap( bool bSymbols );
51 /** Determines if the font character map is the "default". The default map
52 includes all codepoints in the Unicode BMP range, including surrogates.
54 @returns true if default map, false if not default map.
56 bool IsDefaultMap() const;
58 /** Does the font character map include the UCS4 character?
60 @returns true if character exists in font character map, false is not.
62 bool HasChar( sal_UCS4 ) const;
64 /** Returns the number of chars supported by the font, which
65 are inside the unicode range from cMin to cMax (inclusive).
67 @param cMin Lowest codepoint in range to be counted
68 @param cMax Highest codepoint in range to be counted
70 @returns number of characters in the font charmap between the two
71 codepoints.
73 int CountCharsInRange( sal_UCS4 cMin, sal_UCS4 cMax ) const;
75 /** Get the number of characters in the font character map.
77 @returns number of characters in the font character map.
79 int GetCharCount() const;
81 /** Get the first character in the font character map.
83 @returns first character in the font character map.
85 sal_UCS4 GetFirstChar() const;
87 /** Get the last character in the font character map.
89 @returns last character in the font character map.
91 sal_UCS4 GetLastChar() const;
93 /** Get the next character in the font character map. This is important
94 because character maps (e.g. the default map which holds the characters
95 in the BMP plane) can have discontiguous ranges.
97 @param cChar Character from which to find next character
99 @returns next character in the font character map.
101 sal_UCS4 GetNextChar( sal_UCS4 cChar ) const;
103 /** Get the previous character in the font character map. This is important
104 because character maps (e.g. the default map which holds the characters
105 in the BMP plane) can have discontiguous ranges.
107 @param cChar Character from which to find previous character
109 @returns previous character in the font character map.
111 sal_UCS4 GetPrevChar( sal_UCS4 cChar ) const;
113 /** Get the index of a particular character in the font character map. The
114 index is different from the codepoint, because font character maps can
116 determine the index.
118 @param cChar Character used to find index number
120 @returns Index of character in font character map.
122 int GetIndexFromChar( sal_UCS4 cChar ) const;
124 /** Get the character at a particular index in the font character map. The
125 index is different from the codepoint, because font character maps can
127 determine the character.
129 @param nCharIndex Index used to find the character
131 @returns Character in font character map.
133 sal_UCS4 GetCharFromIndex( int nCharIndex ) const;
135 int GetGlyphIndex( sal_UCS4 ) const;
137 private:
138 ImplFontCharMapRef mpImplFontCharMap;
140 friend class ::OutputDevice;
142 int findRangeIndex( sal_UCS4 ) const;
144 FontCharMap( ImplFontCharMapRef const & pIFCMap );
146 // prevent assignment and copy construction
147 FontCharMap( const FontCharMap& ) = delete;
148 void operator=( const FontCharMap& ) = delete;
151 // CmapResult is a normalized version of the many CMAP formats
152 class VCL_PLUGIN_PUBLIC CmapResult
154 public:
155 explicit CmapResult( bool bSymbolic = false,
156 const sal_UCS4* pRangeCodes = nullptr, int nRangeCount = 0 );
158 const sal_UCS4* mpRangeCodes;
159 const int* mpStartGlyphs;
160 const sal_uInt16* mpGlyphIds;
161 int mnRangeCount;
162 bool mbSymbolic;
163 bool mbRecoded;
166 #endif // INCLUDED_FONTCHARMAP_HXX
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */