Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _UNOTOOLS_FONTCVT_HXX
21 : #define _UNOTOOLS_FONTCVT_HXX
22 :
23 : #include <unotools/unotoolsdllapi.h>
24 : #include <tools/string.hxx>
25 :
26 : // ------------------
27 : // - FontToSubsFont -
28 : // ------------------
29 :
30 : #define FONTTOSUBSFONT_IMPORT ((sal_uLong)0x00000001)
31 : #define FONTTOSUBSFONT_EXPORT ((sal_uLong)0x00000002)
32 : #define FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ((sal_uLong)0x00000004)
33 :
34 : typedef void* FontToSubsFontConverter;
35 : UNOTOOLS_DLLPUBLIC FontToSubsFontConverter CreateFontToSubsFontConverter( const String& rFontName, sal_uLong nFlags );
36 : UNOTOOLS_DLLPUBLIC void DestroyFontToSubsFontConverter( FontToSubsFontConverter hConverter );
37 : UNOTOOLS_DLLPUBLIC sal_Unicode ConvertFontToSubsFontChar( FontToSubsFontConverter hConverter, sal_Unicode c );
38 : UNOTOOLS_DLLPUBLIC String GetFontToSubsFontName( FontToSubsFontConverter hConverter );
39 :
40 : // ---------------------------
41 : // - StarSymbolToMSMultiFont -
42 : // ---------------------------
43 :
44 : class UNOTOOLS_DLLPUBLIC StarSymbolToMSMultiFont
45 : {
46 : public:
47 : //Returns the name of the best windows symbol font which this char can be
48 : //mapped to. Sets rChar to the correct position for that font. If no
49 : //match found, then no name is returned, and rChar is unchanged. If you
50 : //want to convert a string, you don't want to use this.
51 : virtual String ConvertChar(sal_Unicode &rChar) = 0;
52 :
53 : //Starts converting the string at position rIndex. It converts as much of
54 : //the string that can be converted to the same symbol font and returns the
55 : //name of that font. rIndex is modified to the last index that was
56 : //converted. Typically you call if continously until rIndex ==
57 : //rString.Len() and handle each section as seperate 8bit strings using
58 : //seperate fonts. Will return an empty string for a continous section
59 : //that has no possible mapping.
60 : virtual String ConvertString(String &rString, xub_StrLen &rIndex) = 0;
61 0 : virtual ~StarSymbolToMSMultiFont() {}
62 : };
63 :
64 : //with bPerfect set the converter will only try and convert symbols which have
65 : //perfect mappings to the windows symbols fonts. With it not set, it will
66 : //allow somewhat more dubious transformations that are nevertheless
67 : //recognizably similiar. Even in this mode there will be characters that fail.
68 : //The users of this might want to make a distinction between failed characters
69 : //which were inside and those outside the unicode private area.
70 : UNOTOOLS_DLLPUBLIC StarSymbolToMSMultiFont *CreateStarSymbolToMSMultiFont(bool bPerfectOnly=false);
71 : #endif // _UNOTOOLS_FONTCVT_HXX
72 :
73 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|