1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
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
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
70 LATIN_PRESENTATION
= 2001,
71 LATIN_SPREADSHEET
= 2002,
76 CJK_PRESENTATION
= 3001,
77 CJK_SPREADSHEET
= 3002,
81 CTL_PRESENTATION
= 4001,
82 CTL_SPREADSHEET
= 4002,
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
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: */