Update git submodules
[LibreOffice.git] / include / unotools / fontdefs.hxx
blobef03e8887a4b2382980d21b6b129f8de0a5f7611
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 .
19 #ifndef INCLUDED_UNOTOOLS_FONTDEFS_HXX
20 #define INCLUDED_UNOTOOLS_FONTDEFS_HXX
22 #include <sal/config.h>
24 #include <string_view>
26 #include <unotools/unotoolsdllapi.h>
27 #include <sal/types.h>
28 #include <rtl/ustring.hxx>
29 #include <o3tl/typed_flags_set.hxx>
30 #include <config_options.h>
32 enum class SubsFontFlags
34 ONLYONE = 0x01,
35 MS = 0x02
38 namespace o3tl
40 template<> struct typed_flags<SubsFontFlags> : is_typed_flags<SubsFontFlags, 0x03> {};
43 UNOTOOLS_DLLPUBLIC OUString GetSubsFontName( std::u16string_view rName, SubsFontFlags nFlags );
45 UNLESS_MERGELIBS(UNOTOOLS_DLLPUBLIC) void AddTokenFontName( OUString& rName, std::u16string_view rNewToken );
48 class UNLESS_MERGELIBS(UNOTOOLS_DLLPUBLIC) ConvertChar
50 public:
51 const sal_Unicode* mpCvtTab;
52 const char* mpSubsFontName;
53 sal_Unicode (*mpCvtFunc)( sal_Unicode );
54 sal_Unicode RecodeChar( sal_Unicode c ) const;
55 void RecodeString( OUString& rStra, sal_Int32 nIndex, sal_Int32 nLen ) const;
56 static const ConvertChar* GetRecodeData( std::u16string_view rOrgFontName, std::u16string_view rMapFontName );
60 enum class DefaultFontType
62 SANS_UNICODE = 1,
63 SANS = 2,
64 SERIF = 3,
65 FIXED = 4,
66 SYMBOL = 5,
67 UI_SANS = 1000,
68 UI_FIXED = 1001,
69 LATIN_TEXT = 2000,
70 LATIN_PRESENTATION = 2001,
71 LATIN_SPREADSHEET = 2002,
72 LATIN_HEADING = 2003,
73 LATIN_DISPLAY = 2004,
74 LATIN_FIXED = 2005,
75 CJK_TEXT = 3000,
76 CJK_PRESENTATION = 3001,
77 CJK_SPREADSHEET = 3002,
78 CJK_HEADING = 3003,
79 CJK_DISPLAY = 3004,
80 CTL_TEXT = 4000,
81 CTL_PRESENTATION = 4001,
82 CTL_SPREADSHEET = 4002,
83 CTL_HEADING = 4003,
84 CTL_DISPLAY = 4004,
87 UNOTOOLS_DLLPUBLIC std::u16string_view GetNextFontToken( std::u16string_view rTokenStr, sal_Int32& rIndex );
88 UNOTOOLS_DLLPUBLIC OUString GetEnglishSearchFontName( std::u16string_view rName );
90 /** Strip any "script font suffix" from the font name
92 Related: fdo#49271 RTF files often contain weird-ass
93 Win 3.1/Win95 style fontnames which attempt to put the
94 charset encoding into the filename
95 http://www.webcenter.ru/~kazarn/eng/fonts_ttf.htm
97 UNOTOOLS_DLLPUBLIC OUString StripScriptFromName(const OUString& rName);
99 /** Determine if the font is the special Open|Star Symbol font
101 @param rFontName
102 The FontName to test for being Open|Star Symbol
104 @return true if this is Open|Star Symbol
106 // FIXME It's quite possible that code using this should instead check for RTL_TEXTENCODING_SYMBOL.
107 UNOTOOLS_DLLPUBLIC bool IsOpenSymbol(std::u16string_view rFontName);
109 #endif // INCLUDED_UNOTOOLS_FONTDEFS_HXX
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */