nss: upgrade to release 3.73
[LibreOffice.git] / include / vcl / fontcharmap.hxx
blobcdd18fcd633e2e261e9149c2153ceb77b3abd927
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 <vcl/vclenum.hxx>
25 #include <tools/ref.hxx>
27 class ImplFontCharMap;
28 class CmapResult;
29 class FontCharMap;
30 class OutputDevice;
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();
43 /** A new FontCharMap is created based on the CmapResult
45 FontCharMap( const CmapResult& rCR );
47 virtual ~FontCharMap() override;
49 /** Get the default font character map
51 @returns the default font character map.
53 static FontCharMapRef GetDefaultMap( bool bSymbols );
55 /** Determines if the font character map is the "default". The default map
56 includes all codepoints in the Unicode BMP range, including surrogates.
58 @returns true if default map, false if not default map.
60 bool IsDefaultMap() const;
62 /** Does the font character map include the UCS4 character?
64 @returns true if character exists in font character map, false is not.
66 bool HasChar( sal_UCS4 ) const;
68 /** Returns the number of chars supported by the font, which
69 are inside the unicode range from cMin to cMax (inclusive).
71 @param cMin Lowest codepoint in range to be counted
72 @param cMax Highest codepoint in range to be counted
74 @returns number of characters in the font charmap between the two
75 codepoints.
77 int CountCharsInRange( sal_UCS4 cMin, sal_UCS4 cMax ) const;
79 /** Get the number of characters in the font character map.
81 @returns number of characters in the font character map.
83 int GetCharCount() const;
85 /** Get the first character in the font character map.
87 @returns first character in the font character map.
89 sal_UCS4 GetFirstChar() const;
91 /** Get the last character in the font character map.
93 @returns last character in the font character map.
95 sal_UCS4 GetLastChar() const;
97 /** Get the next character in the font character map. This is important
98 because character maps (e.g. the default map which holds the characters
99 in the BMP plane) can have discontiguous ranges.
101 @param cChar Character from which to find next character
103 @returns next character in the font character map.
105 sal_UCS4 GetNextChar( sal_UCS4 cChar ) const;
107 /** Get the previous character in the font character map. This is important
108 because character maps (e.g. the default map which holds the characters
109 in the BMP plane) can have discontiguous ranges.
111 @param cChar Character from which to find previous character
113 @returns previous character in the font character map.
115 sal_UCS4 GetPrevChar( sal_UCS4 cChar ) const;
117 /** Get the index of a particular character in the font character map. The
118 index is different from the codepoint, because font character maps can
120 determine the index.
122 @param cChar Character used to find index number
124 @returns Index of character in font character map.
126 int GetIndexFromChar( sal_UCS4 cChar ) const;
128 /** Get the character at a particular index in the font character map. The
129 index is different from the codepoint, because font character maps can
131 determine the character.
133 @param nCharIndex Index used to find the character
135 @returns Character in font character map.
137 sal_UCS4 GetCharFromIndex( int nCharIndex ) const;
139 int GetGlyphIndex( sal_UCS4 ) const;
141 bool isSymbolic() const;
143 private:
144 ImplFontCharMapRef mpImplFontCharMap;
146 friend class ::OutputDevice;
148 int findRangeIndex( sal_UCS4 ) const;
150 FontCharMap( ImplFontCharMapRef const & pIFCMap );
152 // prevent assignment and copy construction
153 FontCharMap( const FontCharMap& ) = delete;
154 void operator=( const FontCharMap& ) = delete;
157 // CmapResult is a normalized version of the many CMAP formats
158 class VCL_PLUGIN_PUBLIC CmapResult
160 public:
161 explicit CmapResult( bool bSymbolic = false,
162 const sal_UCS4* pRangeCodes = nullptr, int nRangeCount = 0 );
164 const sal_UCS4* mpRangeCodes;
165 const int* mpStartGlyphs;
166 const sal_uInt16* mpGlyphIds;
167 int mnRangeCount;
168 bool mbSymbolic;
169 bool mbRecoded;
172 #endif // INCLUDED_FONTCHARMAP_HXX
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */