diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /include/vcl/font | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | include/vcl/font.hxx | 194 | ||||
-rw-r--r-- | include/vcl/font/Feature.hxx | 121 | ||||
-rw-r--r-- | include/vcl/font/FeatureParser.hxx | 48 | ||||
-rw-r--r-- | include/vcl/fontcapabilities.hxx | 203 | ||||
-rw-r--r-- | include/vcl/fontcharmap.hxx | 174 |
5 files changed, 740 insertions, 0 deletions
diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx new file mode 100644 index 000000000..9f910688d --- /dev/null +++ b/include/vcl/font.hxx @@ -0,0 +1,194 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_FONT_HXX +#define INCLUDED_VCL_FONT_HXX + +#include <rtl/ustring.hxx> +#include <sal/types.h> +#include <vcl/dllapi.h> +#include <tools/color.hxx> +#include <tools/fontenum.hxx> +#include <tools/long.hxx> +#include <tools/degree.hxx> +#include <i18nlangtag/lang.h> +#include <vcl/fntstyle.hxx> +#include <o3tl/cow_wrapper.hxx> + +class Size; +class LanguageTag; +class SvStream; + +class ImplFont; +class FontAttributes; +namespace vcl { class Font; } +// need to first declare these outside the vcl namespace, or the friend declarations won't work right +VCL_DLLPUBLIC SvStream& ReadFont( SvStream& rIStm, vcl::Font& ); +VCL_DLLPUBLIC SvStream& WriteFont( SvStream& rOStm, const vcl::Font& ); + +namespace vcl { + +class SAL_WARN_UNUSED VCL_DLLPUBLIC Font +{ +public: + explicit Font(); + Font( const Font& ); // TODO make me explicit + Font( Font&& ) noexcept; + explicit Font( const OUString& rFamilyName, const Size& ); + explicit Font( const OUString& rFamilyName, const OUString& rStyleName, const Size& ); + explicit Font( FontFamily eFamily, const Size& ); + virtual ~Font(); + + const OUString& GetFamilyName() const; + FontFamily GetFamilyType(); + FontFamily GetFamilyType() const; + const OUString& GetStyleName() const; + + FontWeight GetWeight(); + FontWeight GetWeight() const; + FontItalic GetItalic(); + FontItalic GetItalic() const; + FontPitch GetPitch(); + FontPitch GetPitch() const; + FontWidth GetWidthType(); + FontWidth GetWidthType() const; + TextAlign GetAlignment() const; + rtl_TextEncoding GetCharSet() const; + + bool IsSymbolFont() const; + + void SetFamilyName( const OUString& rFamilyName ); + void SetStyleName( const OUString& rStyleName ); + void SetFamily( FontFamily ); + + void SetPitch( FontPitch ePitch ); + void SetItalic( FontItalic ); + void SetWeight( FontWeight ); + void SetWidthType( FontWidth ); + void SetAlignment( TextAlign ); + void SetCharSet( rtl_TextEncoding ); + + void SetSymbolFlag( bool ); + + // Device dependent functions + int GetQuality() const; + + void SetQuality(int); + void IncreaseQualityBy(int); + void DecreaseQualityBy(int); + + // setting the color on the font is obsolete, the only remaining + // valid use is for keeping backward compatibility with old MetaFiles + const Color& GetColor() const; + const Color& GetFillColor() const; + + bool IsTransparent() const; + + void SetColor( const Color& ); + void SetFillColor( const Color& ); + + void SetTransparent( bool bTransparent ); + + void SetFontSize( const Size& ); + const Size& GetFontSize() const; + void SetFontHeight( tools::Long nHeight ); + tools::Long GetFontHeight() const; + void SetAverageFontWidth( tools::Long nWidth ); + tools::Long GetAverageFontWidth() const; + + // tdf#127471 for corrections on EMF/WMF we need the AvgFontWidth in Windows-specific notation + tools::Long GetOrCalculateAverageFontWidth() const; + + // Prefer LanguageTag over LanguageType + void SetLanguageTag( const LanguageTag & ); + const LanguageTag& GetLanguageTag() const; + void SetCJKContextLanguageTag( const LanguageTag& ); + const LanguageTag& GetCJKContextLanguageTag() const; + void SetLanguage( LanguageType ); + LanguageType GetLanguage() const; + void SetCJKContextLanguage( LanguageType ); + LanguageType GetCJKContextLanguage() const; + + void SetOrientation( Degree10 nLineOrientation ); + Degree10 GetOrientation() const; + void SetVertical( bool bVertical ); + bool IsVertical() const; + void SetKerning( FontKerning nKerning ); + FontKerning GetKerning() const; + bool IsKerning() const; + + void SetOutline( bool bOutline ); + bool IsOutline() const; + void SetShadow( bool bShadow ); + bool IsShadow() const; + void SetRelief( FontRelief ); + FontRelief GetRelief() const; + void SetUnderline( FontLineStyle ); + FontLineStyle GetUnderline() const; + void SetOverline( FontLineStyle ); + FontLineStyle GetOverline() const; + void SetStrikeout( FontStrikeout ); + FontStrikeout GetStrikeout() const; + void SetEmphasisMark( FontEmphasisMark ); + FontEmphasisMark GetEmphasisMark() const; + void SetWordLineMode( bool bWordLine ); + bool IsWordLineMode() const; + + void Merge( const Font& rFont ); + void GetFontAttributes( FontAttributes& rAttrs ) const; + + Font& operator=( const Font& ); + Font& operator=( Font&& ) noexcept; + bool operator==( const Font& ) const; + bool operator!=( const Font& rFont ) const + { return !(Font::operator==( rFont )); } + bool IsSameInstance( const Font& ) const; + bool EqualIgnoreColor( const Font& ) const; + + // Compute value usable as hash. + size_t GetHashValue() const; + size_t GetHashValueIgnoreColor() const; + + friend VCL_DLLPUBLIC SvStream& ::ReadFont( SvStream& rIStm, vcl::Font& ); + friend VCL_DLLPUBLIC SvStream& ::WriteFont( SvStream& rOStm, const vcl::Font& ); + + static Font identifyFont( const void* pBuffer, sal_uInt32 nLen ); + + typedef o3tl::cow_wrapper< ImplFont > ImplType; + + inline bool IsUnderlineAbove() const; + +private: + ImplType mpImplFont; +}; + +inline bool Font::IsUnderlineAbove() const +{ + if (!IsVertical()) + return false; + // the underline is right for Japanese only + return (LANGUAGE_JAPANESE == GetLanguage()) || + (LANGUAGE_JAPANESE == GetCJKContextLanguage()); +} + +} + +#endif // _VCL_FONT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/font/Feature.hxx b/include/vcl/font/Feature.hxx new file mode 100644 index 000000000..3026f105f --- /dev/null +++ b/include/vcl/font/Feature.hxx @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_VCL_FONT_FEATURE_HXX +#define INCLUDED_VCL_FONT_FEATURE_HXX + +#include <vcl/dllapi.h> +#include <rtl/ustring.hxx> +#include <unotools/resmgr.hxx> +#include <vector> + +namespace vcl::font +{ +constexpr uint32_t featureCode(const char sFeature[4]) +{ + return static_cast<uint32_t>(sFeature[0]) << 24U | static_cast<uint32_t>(sFeature[1]) << 16U + | static_cast<uint32_t>(sFeature[2]) << 8U | static_cast<uint32_t>(sFeature[3]); +} + +VCL_DLLPUBLIC OUString featureCodeAsString(uint32_t nFeature); + +enum class FeatureParameterType +{ + BOOL, + ENUM +}; + +enum class FeatureType +{ + OpenType, + Graphite +}; + +struct VCL_DLLPUBLIC FeatureParameter +{ +private: + uint32_t m_nCode; + OUString m_sDescription; + TranslateId m_pDescriptionID; + +public: + FeatureParameter(uint32_t nCode, OUString aDescription); + FeatureParameter(uint32_t nCode, TranslateId pDescriptionID); + + uint32_t getCode() const; + OUString getDescription() const; +}; + +class VCL_DLLPUBLIC FeatureDefinition +{ +private: + OUString m_sDescription; + TranslateId m_pDescriptionID; + OUString m_sNumericPart; + uint32_t m_nCode; + uint32_t m_nDefault; + FeatureParameterType m_eType; + // the index of the parameter defines the enum value, string is the description + std::vector<FeatureParameter> m_aEnumParameters; + +public: + FeatureDefinition(); + FeatureDefinition(uint32_t nCode, OUString const& rDescription, + FeatureParameterType eType = FeatureParameterType::BOOL, + std::vector<FeatureParameter>&& rEnumParameters + = std::vector<FeatureParameter>{}, + uint32_t nDefault = 0); + FeatureDefinition(uint32_t nCode, TranslateId pDescriptionID, + OUString const& rNumericPart = OUString()); + FeatureDefinition(uint32_t nCode, TranslateId pDescriptionID, + std::vector<FeatureParameter> aEnumParameters); + + const std::vector<FeatureParameter>& getEnumParameters() const; + uint32_t getCode() const; + OUString getDescription() const; + FeatureParameterType getType() const; + uint32_t getDefault() const; + + operator bool() const; +}; + +struct VCL_DLLPUBLIC FeatureID +{ + uint32_t m_aFeatureCode; + uint32_t m_aScriptCode; + uint32_t m_aLanguageCode; +}; + +struct Feature +{ + Feature(); + Feature(FeatureID const& rID, FeatureType eType); + + FeatureID m_aID; + FeatureType m_eType; + FeatureDefinition m_aDefinition; +}; + +// This is basically duplicates hb_feature_t to avoid including HarfBuzz +// headers here, so the member types should remain compatible. +struct FeatureSetting +{ + FeatureSetting(OString feature); + + uint32_t m_nTag; + uint32_t m_nValue; + unsigned int m_nStart; + unsigned int m_nEnd; +}; + +} // namespace vcl::font + +#endif // INCLUDED_VCL_FONT_FEATURE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/font/FeatureParser.hxx b/include/vcl/font/FeatureParser.hxx new file mode 100644 index 000000000..93fe6eabe --- /dev/null +++ b/include/vcl/font/FeatureParser.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_VCL_FONT_FEATUREPASER_HXX +#define INCLUDED_VCL_FONT_FEATUREPASER_HXX + +#include <vcl/dllapi.h> +#include <rtl/ustring.hxx> +#include <vector> +#include <unordered_map> + +#include <vcl/font/Feature.hxx> + +namespace vcl::font +{ +// These must not conflict with font name lists which use ; and , +constexpr const char FeaturePrefix = ':'; +constexpr const char FeatureSeparator = '&'; + +VCL_DLLPUBLIC OUString trimFontNameFeatures(OUString const& rFontName); + +class VCL_DLLPUBLIC FeatureParser +{ +private: + OUString m_sLanguage; + std::vector<FeatureSetting> m_aFeatures; + +public: + FeatureParser(std::u16string_view sFontName); + + OUString const& getLanguage() const { return m_sLanguage; } + + std::vector<FeatureSetting> const& getFeatures() const { return m_aFeatures; } + + std::unordered_map<uint32_t, uint32_t> getFeaturesMap() const; +}; + +} // namespace vcl::font + +#endif // INCLUDED_VCL_FONT_FEATUREPASER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/fontcapabilities.hxx b/include/vcl/fontcapabilities.hxx new file mode 100644 index 000000000..9698be7a5 --- /dev/null +++ b/include/vcl/fontcapabilities.hxx @@ -0,0 +1,203 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_VCL_FONTCAPABILITIES_HXX +#define INCLUDED_VCL_FONTCAPABILITIES_HXX + +#include <optional> +#include <bitset> + +//See OS/2 table, i.e. http://www.microsoft.com/typography/otspec/os2.htm#ur +namespace vcl +{ + namespace UnicodeCoverage + { + enum UnicodeCoverageEnum + { + BASIC_LATIN = 0, + LATIN_1_SUPPLEMENT = 1, + LATIN_EXTENDED_A = 2, + LATIN_EXTENDED_B = 3, + IPA_EXTENSIONS = 4, + SPACING_MODIFIER_LETTERS = 5, + COMBINING_DIACRITICAL_MARKS = 6, + GREEK_AND_COPTIC = 7, + COPTIC = 8, + CYRILLIC = 9, + ARMENIAN = 10, + HEBREW = 11, + VAI = 12, + ARABIC = 13, + NKO = 14, + DEVANAGARI = 15, + BENGALI = 16, + GURMUKHI = 17, + GUJARATI = 18, + ODIA = 19, + TAMIL = 20, + TELUGU = 21, + KANNADA = 22, + MALAYALAM = 23, + THAI = 24, + LAO = 25, + GEORGIAN = 26, + BALINESE = 27, + HANGUL_JAMO = 28, + LATIN_EXTENDED_ADDITIONAL = 29, + GREEK_EXTENDED = 30, + GENERAL_PUNCTUATION = 31, + SUPERSCRIPTS_AND_SUBSCRIPTS = 32, + CURRENCY_SYMBOLS = 33, + COMBINING_DIACRITICAL_MARKS_FOR_SYMBOLS = 34, + LETTERLIKE_SYMBOLS = 35, + NUMBER_FORMS = 36, + ARROWS = 37, + MATHEMATICAL_OPERATORS = 38, + MISCELLANEOUS_TECHNICAL = 39, + CONTROL_PICTURES = 40, + OPTICAL_CHARACTER_RECOGNITION = 41, + ENCLOSED_ALPHANUMERICS = 42, + BOX_DRAWING = 43, + BLOCK_ELEMENTS = 44, + GEOMETRIC_SHAPES = 45, + MISCELLANEOUS_SYMBOLS = 46, + DINGBATS = 47, + CJK_SYMBOLS_AND_PUNCTUATION = 48, + HIRAGANA = 49, + KATAKANA = 50, + BOPOMOFO = 51, + HANGUL_COMPATIBILITY_JAMO = 52, + PHAGS_PA = 53, + ENCLOSED_CJK_LETTERS_AND_MONTHS = 54, + CJK_COMPATIBILITY = 55, + HANGUL_SYLLABLES = 56, + NONPLANE_0 = 57, + PHOENICIAN = 58, + CJK_UNIFIED_IDEOGRAPHS = 59, + PRIVATE_USE_AREA_PLANE_0 = 60, + CJK_STROKES = 61, + ALPHABETIC_PRESENTATION_FORMS = 62, + ARABIC_PRESENTATION_FORMS_A = 63, + COMBINING_HALF_MARKS = 64, + VERTICAL_FORMS = 65, + SMALL_FORM_VARIANTS = 66, + ARABIC_PRESENTATION_FORMS_B = 67, + HALFWIDTH_AND_FULLWIDTH_FORMS = 68, + SPECIALS = 69, + TIBETAN = 70, + SYRIAC = 71, + THAANA = 72, + SINHALA = 73, + MYANMAR = 74, + ETHIOPIC = 75, + CHEROKEE = 76, + UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS = 77, + OGHAM = 78, + RUNIC = 79, + KHMER = 80, + MONGOLIAN = 81, + BRAILLE_PATTERNS = 82, + YI_SYLLABLES = 83, + TAGALOG = 84, + OLD_ITALIC = 85, + GOTHIC = 86, + DESERET = 87, + BYZANTINE_MUSICAL_SYMBOLS = 88, + MATHEMATICAL_ALPHANUMERIC_SYMBOLS = 89, + PRIVATE_USE_PLANE_15 = 90, + VARIATION_SELECTORS = 91, + TAGS = 92, + LIMBU = 93, + TAI_LE = 94, + NEW_TAI_LUE = 95, + BUGINESE = 96, + GLAGOLITIC = 97, + TIFINAGH = 98, + YIJING_HEXAGRAM_SYMBOLS = 99, + SYLOTI_NAGRI = 100, + LINEAR_B_SYLLABARY = 101, + ANCIENT_GREEK_NUMBERS = 102, + UGARITIC = 103, + OLD_PERSIAN = 104, + SHAVIAN = 105, + OSMANYA = 106, + CYPRIOT_SYLLABARY = 107, + KHAROSHTHI = 108, + TAI_XUAN_JING_SYMBOLS = 109, + CUNEIFORM = 110, + COUNTING_ROD_NUMERALS = 111, + SUNDANESE = 112, + LEPCHA = 113, + OL_CHIKI = 114, + SAURASHTRA = 115, + KAYAH_LI = 116, + REJANG = 117, + CHAM = 118, + ANCIENT_SYMBOLS = 119, + PHAISTOS_DISC = 120, + CARIAN = 121, + DOMINO_TILES = 122, + RESERVED1 = 123, + RESERVED2 = 124, + RESERVED3 = 125, + RESERVED4 = 126, + RESERVED5 = 127, + MAX_UC_ENUM = 128 + }; + }; + + namespace CodePageCoverage + { + enum CodePageCoverageEnum + { + CP1252 = 0, + CP1250 = 1, + CP1251 = 2, + CP1253 = 3, + CP1254 = 4, + CP1255 = 5, + CP1256 = 6, + CP1257 = 7, + CP1258 = 8, + CP874 = 16, + CP932 = 17, + CP936 = 18, + CP949 = 19, + CP950 = 20, + CP1361 = 21, + CP869 = 48, + CP866 = 49, + CP865 = 50, + CP864 = 51, + CP863 = 52, + CP862 = 53, + CP861 = 54, + CP860 = 55, + CP857 = 56, + CP855 = 57, + CP852 = 58, + CP775 = 59, + CP737 = 60, + CP780 = 61, + CP850 = 62, + CP437 = 63, + MAX_CP_ENUM = 64 + }; + }; + + struct FontCapabilities + { + std::optional<std::bitset<UnicodeCoverage::MAX_UC_ENUM>> oUnicodeRange; + std::optional<std::bitset<CodePageCoverage::MAX_CP_ENUM>> oCodePageRange; + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/fontcharmap.hxx b/include/vcl/fontcharmap.hxx new file mode 100644 index 000000000..ade1da6e7 --- /dev/null +++ b/include/vcl/fontcharmap.hxx @@ -0,0 +1,174 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_FONTCHARMAP_HXX +#define INCLUDED_FONTCHARMAP_HXX + +#include <vcl/dllapi.h> +#include <vcl/vclenum.hxx> +#include <tools/ref.hxx> + +class ImplFontCharMap; +class CmapResult; +class FontCharMap; +class OutputDevice; + +typedef tools::SvRef<ImplFontCharMap> ImplFontCharMapRef; +typedef tools::SvRef<FontCharMap> FontCharMapRef; + +class VCL_DLLPUBLIC FontCharMap final : public SvRefBase +{ +public: + /** A new FontCharMap is created based on a "default" map, which includes + all codepoints in the Unicode BMP range, including surrogates. + **/ + FontCharMap(); + + /** A new FontCharMap is created based on the CmapResult + */ + FontCharMap( const CmapResult& rCR ); + + virtual ~FontCharMap() override; + + /** Get the default font character map + + @returns the default font character map. + */ + static FontCharMapRef GetDefaultMap( bool bSymbols ); + + /** Determines if the font character map is the "default". The default map + includes all codepoints in the Unicode BMP range, including surrogates. + + @returns true if default map, false if not default map. + */ + bool IsDefaultMap() const; + + /** Does the font character map include the UCS4 character? + + @returns true if character exists in font character map, false is not. + */ + bool HasChar( sal_UCS4 ) const; + + /** Returns the number of chars supported by the font, which + are inside the unicode range from cMin to cMax (inclusive). + + @param cMin Lowest codepoint in range to be counted + @param cMax Highest codepoint in range to be counted + + @returns number of characters in the font charmap between the two + codepoints. + */ + int CountCharsInRange( sal_UCS4 cMin, sal_UCS4 cMax ) const; + + /** Get the number of characters in the font character map. + + @returns number of characters in the font character map. + */ + int GetCharCount() const; + + /** Get the first character in the font character map. + + @returns first character in the font character map. + */ + sal_UCS4 GetFirstChar() const; + + /** Get the last character in the font character map. + + @returns last character in the font character map. + */ + sal_UCS4 GetLastChar() const; + + /** Get the next character in the font character map. This is important + because character maps (e.g. the default map which holds the characters + in the BMP plane) can have discontiguous ranges. + + @param cChar Character from which to find next character + + @returns next character in the font character map. + */ + sal_UCS4 GetNextChar( sal_UCS4 cChar ) const; + + /** Get the previous character in the font character map. This is important + because character maps (e.g. the default map which holds the characters + in the BMP plane) can have discontiguous ranges. + + @param cChar Character from which to find previous character + + @returns previous character in the font character map. + */ + sal_UCS4 GetPrevChar( sal_UCS4 cChar ) const; + + /** Get the index of a particular character in the font character map. The + index is different from the codepoint, because font character maps can + + determine the index. + + @param cChar Character used to find index number + + @returns Index of character in font character map. + */ + int GetIndexFromChar( sal_UCS4 cChar ) const; + + /** Get the character at a particular index in the font character map. The + index is different from the codepoint, because font character maps can + + determine the character. + + @param nCharIndex Index used to find the character + + @returns Character in font character map. + */ + sal_UCS4 GetCharFromIndex( int nCharIndex ) const; + + int GetGlyphIndex( sal_UCS4 ) const; + + bool isSymbolic() const; + +private: + ImplFontCharMapRef mpImplFontCharMap; + + friend class ::OutputDevice; + + int findRangeIndex( sal_UCS4 ) const; + + FontCharMap( ImplFontCharMapRef const & pIFCMap ); + + // prevent assignment and copy construction + FontCharMap( const FontCharMap& ) = delete; + void operator=( const FontCharMap& ) = delete; +}; + +// CmapResult is a normalized version of the many CMAP formats +class VCL_PLUGIN_PUBLIC CmapResult +{ +public: + explicit CmapResult( bool bSymbolic = false, + const sal_UCS4* pRangeCodes = nullptr, int nRangeCount = 0 ); + + const sal_UCS4* mpRangeCodes; + const int* mpStartGlyphs; + const sal_uInt16* mpGlyphIds; + int mnRangeCount; + bool mbSymbolic; + bool mbRecoded; +}; + +#endif // INCLUDED_FONTCHARMAP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |