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 #include <svtools/sampletext.hxx>
10 #include <vcl/font.hxx>
11 #include <vcl/outdev.hxx>
12 #include <vcl/virdev.hxx>
13 #include <vcl/metric.hxx>
14 #include <i18nutil/unicode.hxx>
16 bool isOpenSymbolFont(const Font
&rFont
)
18 return rFont
.GetName().EqualsIgnoreCaseAscii("starsymbol") ||
19 rFont
.GetName().EqualsIgnoreCaseAscii("opensymbol");
22 bool isSymbolFont(const Font
&rFont
)
24 return (rFont
.GetCharSet() == RTL_TEXTENCODING_SYMBOL
) ||
25 rFont
.GetName().EqualsIgnoreCaseAscii("cmsy10") ||
26 rFont
.GetName().EqualsIgnoreCaseAscii("cmex10") ||
27 rFont
.GetName().EqualsIgnoreCaseAscii("feta26") ||
28 rFont
.GetName().EqualsIgnoreCaseAscii("jsMath-cmsy10") ||
29 rFont
.GetName().EqualsIgnoreCaseAscii("jsMath-cmex10") ||
30 rFont
.GetName().EqualsIgnoreCaseAscii("msam10") ||
31 rFont
.GetName().EqualsIgnoreCaseAscii("msbm10") ||
32 rFont
.GetName().EqualsIgnoreCaseAscii("wasy10") ||
33 rFont
.GetName().EqualsIgnoreCaseAscii("Denemo") ||
34 rFont
.GetName().EqualsIgnoreCaseAscii("GlyphBasic1") ||
35 rFont
.GetName().EqualsIgnoreCaseAscii("GlyphBasic2") ||
36 rFont
.GetName().EqualsIgnoreCaseAscii("GlyphBasic3") ||
37 rFont
.GetName().EqualsIgnoreCaseAscii("GlyphBasic4") ||
38 rFont
.GetName().EqualsIgnoreCaseAscii("Letters Laughing") ||
39 rFont
.GetName().EqualsIgnoreCaseAscii("MusiQwik") ||
40 rFont
.GetName().EqualsIgnoreCaseAscii("MusiSync") ||
41 isOpenSymbolFont(rFont
);
44 bool canRenderNameOfSelectedFont(OutputDevice
&rDevice
)
46 const Font
&rFont
= rDevice
.GetFont();
47 return !isSymbolFont(rFont
) && (STRING_LEN
== rDevice
.HasGlyphs(rFont
, rFont
.GetName()));
50 OUString
makeShortRepresentativeSymbolTextForSelectedFont(OutputDevice
&rDevice
)
52 const bool bOpenSymbol
= isOpenSymbolFont(rDevice
.GetFont());
56 FontCharMap aFontCharMap
;
57 bool bHasCharMap
= rDevice
.GetFontCharMap(aFontCharMap
);
60 // use some sample characters available in the font
63 // start just above the PUA used by most symbol fonts
64 sal_uInt32 cNewChar
= 0xFF00;
66 // on MacOSX there are too many non-presentable symbols above the codepoint 0x0192
71 const int nMaxCount
= sizeof(aText
)/sizeof(*aText
) - 1;
72 int nSkip
= aFontCharMap
.GetCharCount() / nMaxCount
;
77 for( int i
= 0; i
< nMaxCount
; ++i
)
79 sal_uInt32 cOldChar
= cNewChar
;
80 for( int j
= nSkip
; --j
>= 0; )
81 cNewChar
= aFontCharMap
.GetPrevChar( cNewChar
);
82 if( cOldChar
== cNewChar
)
84 aText
[ i
] = static_cast<sal_Unicode
>(cNewChar
); // TODO: support UCS4 samples
88 return OUString(aText
);
92 static sal_Unicode aImplSymbolFontText
[] = {
93 0xF021,0xF032,0xF043,0xF054,0xF065,0xF076,0xF0B7,0xF0C8,0};
94 static sal_Unicode aImplStarSymbolText
[] = {
95 0x2706,0x2704,0x270D,0xE033,0x2211,0x2288,0};
96 const sal_Unicode
* pText
= bOpenSymbol
? aImplStarSymbolText
: aImplSymbolFontText
;
97 OUString
sSampleText(pText
);
98 bool bHasSampleTextGlyphs
= (STRING_LEN
== rDevice
.HasGlyphs(rDevice
.GetFont(), sSampleText
));
99 return bHasSampleTextGlyphs
? sSampleText
: OUString();
102 //These ones are typically for use in the font dropdown box beside the
103 //fontname, so say things roughly like "Script/Alphabet/Name-Of-Major-Language"
105 //Here we don't always know the language of course, only the script that can be
106 //written with the font. Often that's one single language written in that
107 //script, or a handful of related languages where the name of the script is the
108 //same between languages, or the name in the major language is known by most
109 //readers of the minor languages, e.g. Yiddish is written with the HEBREW
110 //script as well, the vast majority of Yiddish readers will be able to read
112 OUString
makeShortRepresentativeTextForScript(UScriptCode eScript
)
114 OUString sSampleText
;
119 const sal_Unicode aGrek
[] = {
120 0x0391, 0x03BB, 0x03C6, 0x03AC, 0x03B2, 0x03B7, 0x03C4, 0x03BF
122 sSampleText
= OUString(aGrek
, SAL_N_ELEMENTS(aGrek
));
127 const sal_Unicode aHebr
[] = {
128 0x05D0, 0x05B8, 0x05DC, 0x05B6, 0x05E3, 0x05BE, 0x05D1, 0x05B5,
129 0x05BC, 0x05D9, 0x05EA, 0x0020, 0x05E2, 0x05B4, 0x05D1, 0x05B0,
130 0x05E8, 0x05B4, 0x05D9
132 sSampleText
= OUString(aHebr
, SAL_N_ELEMENTS(aHebr
));
137 const sal_Unicode aArab
[] = {
138 0x0623, 0x0628, 0x062C, 0x062F, 0x064A, 0x0629, 0x0020, 0x0639,
139 0x0631, 0x0628, 0x064A, 0x0629
141 sSampleText
= OUString(aArab
, SAL_N_ELEMENTS(aArab
));
144 case USCRIPT_DEVANAGARI
:
146 const sal_Unicode aDeva
[] = {
147 0x0926, 0x0947, 0x0935, 0x0928, 0x093E, 0x0917, 0x0930, 0x0940
149 sSampleText
= OUString(aDeva
, SAL_N_ELEMENTS(aDeva
));
152 case USCRIPT_BENGALI
:
154 const sal_Unicode aBeng
[] = {
155 0x09AC, 0x09BE, 0x0982, 0x09B2, 0x09BE, 0x0020, 0x09B2, 0x09BF,
158 sSampleText
= OUString(aBeng
, SAL_N_ELEMENTS(aBeng
));
161 case USCRIPT_GURMUKHI
:
163 const sal_Unicode aGuru
[] = {
164 0x0A17, 0x0A41, 0x0A30, 0x0A2E, 0x0A41, 0x0A16, 0x0A40
166 sSampleText
= OUString(aGuru
, SAL_N_ELEMENTS(aGuru
));
169 case USCRIPT_GUJARATI
:
171 const sal_Unicode aGujr
[] = {
172 0x0A97, 0x0AC1, 0x0A9C, 0x0AB0, 0x0ABE, 0x0AA4, 0x0aC0, 0x0020,
173 0x0AB2, 0x0ABF, 0x0AAA, 0x0ABF
175 sSampleText
= OUString(aGujr
, SAL_N_ELEMENTS(aGujr
));
180 const sal_Unicode aOrya
[] = {
181 0x0B09, 0x0B24, 0x0B4D, 0x0B15, 0x0B33, 0x0020, 0x0B32, 0x0B3F,
184 sSampleText
= OUString(aOrya
, SAL_N_ELEMENTS(aOrya
));
189 const sal_Unicode aTaml
[] = {
190 0x0B85, 0x0BB0, 0x0BBF, 0x0B9A, 0x0BCD, 0x0B9A, 0x0BC1, 0x0BB5,
193 sSampleText
= OUString(aTaml
, SAL_N_ELEMENTS(aTaml
));
198 const sal_Unicode aTelu
[] = {
199 0x0C24, 0x0C46, 0x0C32, 0x0C41, 0x0C17, 0x0C41
201 sSampleText
= OUString(aTelu
, SAL_N_ELEMENTS(aTelu
));
204 case USCRIPT_KANNADA
:
206 const sal_Unicode aKnda
[] = {
207 0x0C95, 0x0CA8, 0x0CCD, 0x0CA8, 0x0CA1, 0x0020, 0x0CB2, 0x0CBF,
210 sSampleText
= OUString(aKnda
, SAL_N_ELEMENTS(aKnda
));
213 case USCRIPT_MALAYALAM
:
215 const sal_Unicode aMlym
[] = {
216 0x0D2E, 0x0D32, 0x0D2F, 0x0D3E, 0x0D33, 0x0D32, 0x0D3F, 0x0D2A,
219 sSampleText
= OUString(aMlym
, SAL_N_ELEMENTS(aMlym
));
224 const sal_Unicode aThai
[] = {
225 0x0E2D, 0x0E31, 0x0E01, 0x0E29, 0x0E23, 0x0E44, 0x0E17, 0x0E22
227 sSampleText
= OUString(aThai
, SAL_N_ELEMENTS(aThai
));
232 const sal_Unicode aLao
[] = {
233 0x0EAD, 0x0EB1, 0x0E81, 0x0EAA, 0x0EAD, 0x0E99, 0x0EA5, 0x0EB2,
236 sSampleText
= OUString(aLao
, SAL_N_ELEMENTS(aLao
));
239 case USCRIPT_GEORGIAN
:
241 const sal_Unicode aGeorgian
[] = {
242 0x10D3, 0x10D0, 0x10DB, 0x10EC, 0x10D4, 0x10E0, 0x10DA, 0x10DD,
245 sSampleText
= OUString(aGeorgian
, SAL_N_ELEMENTS(aGeorgian
));
251 const sal_Unicode aHang
[] = {
254 sSampleText
= OUString(aHang
, SAL_N_ELEMENTS(aHang
));
257 case USCRIPT_TIBETAN
:
259 const sal_Unicode aTibt
[] = {
260 0x0F51, 0x0F56, 0x0F74, 0x0F0B, 0x0F45, 0x0F53, 0x0F0B
262 sSampleText
= OUString(aTibt
, SAL_N_ELEMENTS(aTibt
));
267 const sal_Unicode aSyri
[] = {
268 0x0723, 0x071B, 0x072A, 0x0722, 0x0713, 0x0720, 0x0710
270 sSampleText
= OUString(aSyri
, SAL_N_ELEMENTS(aSyri
));
275 const sal_Unicode aThaa
[] = {
276 0x078C, 0x07A7, 0x0782, 0x07A6
278 sSampleText
= OUString(aThaa
, SAL_N_ELEMENTS(aThaa
));
281 case USCRIPT_SINHALA
:
283 const sal_Unicode aSinh
[] = {
284 0x0DC1, 0x0DD4, 0x0DAF, 0x0DCA, 0x0DB0, 0x0020, 0x0DC3, 0x0DD2,
285 0x0D82, 0x0DC4, 0x0DBD
287 sSampleText
= OUString(aSinh
, SAL_N_ELEMENTS(aSinh
));
290 case USCRIPT_MYANMAR
:
292 const sal_Unicode aMymr
[] = {
293 0x1019, 0x103C, 0x1014, 0x103A, 0x1019, 0x102C, 0x1021, 0x1000,
294 0x1039, 0x1001, 0x101B, 0x102C
296 sSampleText
= OUString(aMymr
, SAL_N_ELEMENTS(aMymr
));
299 case USCRIPT_ETHIOPIC
:
301 const sal_Unicode aEthi
[] = {
302 0x130D, 0x12D5, 0x12DD
304 sSampleText
= OUString(aEthi
, SAL_N_ELEMENTS(aEthi
));
307 case USCRIPT_CHEROKEE
:
309 const sal_Unicode aCher
[] = {
310 0x13D7, 0x13AA, 0x13EA, 0x13B6, 0x13D9, 0x13D7
312 sSampleText
= OUString(aCher
, SAL_N_ELEMENTS(aCher
));
317 const sal_Unicode aKhmr
[] = {
318 0x17A2, 0x1780, 0x17D2, 0x1781, 0x179A, 0x1780, 0x17D2, 0x179A,
319 0x1798, 0x1781, 0x17C1, 0x1798, 0x179A, 0x1797, 0x17B6, 0x179F,
322 sSampleText
= OUString(aKhmr
, SAL_N_ELEMENTS(aKhmr
));
325 case USCRIPT_MONGOLIAN
:
327 const sal_Unicode aMongolian
[] = {
328 0x182A, 0x1822, 0x1834, 0x1822, 0x182D, 0x180C
330 sSampleText
= OUString(aMongolian
, SAL_N_ELEMENTS(aMongolian
));
333 case USCRIPT_TAGALOG
:
335 const sal_Unicode aTagalog
[] = {
336 0x170A, 0x170A, 0x170C, 0x1712
338 sSampleText
= OUString(aTagalog
, SAL_N_ELEMENTS(aTagalog
));
341 case USCRIPT_NEW_TAI_LUE
:
343 const sal_Unicode aTalu
[] = {
344 0x1991, 0x19BA, 0x199F, 0x19B9, 0x19C9
346 sSampleText
= OUString(aTalu
, SAL_N_ELEMENTS(aTalu
));
349 case USCRIPT_TRADITIONAL_HAN
:
351 const sal_Unicode aHant
[] = {
354 sSampleText
= OUString(aHant
, SAL_N_ELEMENTS(aHant
));
357 case USCRIPT_SIMPLIFIED_HAN
:
359 const sal_Unicode aHans
[] = {
362 sSampleText
= OUString(aHans
, SAL_N_ELEMENTS(aHans
));
367 const sal_Unicode aSimplifiedAndTraditionalChinese
[] = {
370 sSampleText
= OUString(aSimplifiedAndTraditionalChinese
,
371 SAL_N_ELEMENTS(aSimplifiedAndTraditionalChinese
));
374 case USCRIPT_JAPANESE
:
376 const sal_Unicode aJpan
[] = {
377 0x65E5, 0x672C, 0x8A9E
379 sSampleText
= OUString(aJpan
, SAL_N_ELEMENTS(aJpan
));
384 const sal_Unicode aYiii
[] = {
385 0xA188, 0xA320, 0xA071, 0xA0B7
387 sSampleText
= OUString(aYiii
, SAL_N_ELEMENTS(aYiii
));
390 case USCRIPT_PHAGS_PA
:
392 const sal_Unicode aPhag
[] = {
393 0xA84F, 0xA861, 0xA843, 0x0020, 0xA863, 0xA861, 0xA859, 0x0020,
394 0xA850, 0xA85C, 0xA85E
396 sSampleText
= OUString(aPhag
, SAL_N_ELEMENTS(aPhag
));
401 const sal_Unicode aTale
[] = {
402 0x1956, 0x196D, 0x1970, 0x1956, 0x196C, 0x1973, 0x1951, 0x1968,
405 sSampleText
= OUString(aTale
, SAL_N_ELEMENTS(aTale
));
409 sSampleText
= OUString("Lorem ipsum");
417 OUString
makeRepresentativeTextForScript(UScriptCode eScript
)
419 OUString sSampleText
;
422 case USCRIPT_TRADITIONAL_HAN
:
423 case USCRIPT_SIMPLIFIED_HAN
:
426 //Three Character Classic
427 const sal_Unicode aZh
[] = {
428 0x4EBA, 0x4E4B, 0x521D, 0x0020, 0x6027, 0x672C, 0x5584
430 sSampleText
= OUString(aZh
, SAL_N_ELEMENTS(aZh
));
433 case USCRIPT_JAPANESE
:
435 //'Beautiful Japanese'
436 const sal_Unicode aJa
[] = {
437 0x7F8E, 0x3057, 0x3044, 0x65E5, 0x672C, 0x8A9E
439 sSampleText
= OUString(aJa
, SAL_N_ELEMENTS(aJa
));
445 //The essential condition for...
446 const sal_Unicode aKo
[] = {
447 0xD0A4, 0xC2A4, 0xC758, 0x0020, 0xACE0, 0xC720, 0xC870,
450 sSampleText
= OUString(aKo
, SAL_N_ELEMENTS(aKo
));
457 if (sSampleText
.isEmpty())
458 sSampleText
= makeShortRepresentativeTextForScript(eScript
);
462 OUString
makeShortMinimalTextForScript(UScriptCode eScript
)
464 OUString sSampleText
;
469 const sal_Unicode aGrek
[] = {
472 sSampleText
= OUString(aGrek
, SAL_N_ELEMENTS(aGrek
));
477 const sal_Unicode aHebr
[] = {
480 sSampleText
= OUString(aHebr
, SAL_N_ELEMENTS(aHebr
));
489 OUString
makeMinimalTextForScript(UScriptCode eScript
)
491 return makeShortMinimalTextForScript(eScript
);
494 //These ones are typically for use in the font preview window in format
497 //There we generally know the language. Though its possible for the language to
500 //Currently we fall back to makeShortRepresentativeTextForScript when we don't
501 //have suitable strings
502 OUString
makeRepresentativeTextForLanguage(LanguageType eLang
)
505 switch( eLang
& LANGUAGE_MASK_PRIMARY
)
507 case LANGUAGE_CHINESE
& LANGUAGE_MASK_PRIMARY
:
508 sRet
= makeRepresentativeTextForScript(USCRIPT_HAN
);
510 case LANGUAGE_GREEK
& LANGUAGE_MASK_PRIMARY
:
511 sRet
= makeRepresentativeTextForScript(USCRIPT_GREEK
);
513 case LANGUAGE_HEBREW
& LANGUAGE_MASK_PRIMARY
:
514 case LANGUAGE_YIDDISH
& LANGUAGE_MASK_PRIMARY
:
515 sRet
= makeRepresentativeTextForScript(USCRIPT_HEBREW
);
517 case LANGUAGE_ARABIC_SAUDI_ARABIA
& LANGUAGE_MASK_PRIMARY
:
518 sRet
= makeRepresentativeTextForScript(USCRIPT_ARABIC
);
520 case LANGUAGE_HINDI
& LANGUAGE_MASK_PRIMARY
:
521 sRet
= makeRepresentativeTextForScript(USCRIPT_DEVANAGARI
);
523 case LANGUAGE_ASSAMESE
& LANGUAGE_MASK_PRIMARY
:
525 const sal_Unicode aAs
[] = {
526 0x0985, 0x09B8, 0x09AE, 0x09C0, 0x09AF, 0x09BC, 0x09BE,
527 0x0020, 0x0986, 0x0996, 0x09F0
529 sRet
= OUString(aAs
, SAL_N_ELEMENTS(aAs
));
532 case LANGUAGE_BENGALI
& LANGUAGE_MASK_PRIMARY
:
533 sRet
= makeRepresentativeTextForScript(USCRIPT_BENGALI
);
535 case LANGUAGE_PUNJABI
& LANGUAGE_MASK_PRIMARY
:
536 sRet
= makeRepresentativeTextForScript(USCRIPT_GURMUKHI
);
538 case LANGUAGE_GUJARATI
& LANGUAGE_MASK_PRIMARY
:
539 sRet
= makeRepresentativeTextForScript(USCRIPT_GUJARATI
);
541 case LANGUAGE_ORIYA
& LANGUAGE_MASK_PRIMARY
:
542 sRet
= makeRepresentativeTextForScript(USCRIPT_ORIYA
);
544 case LANGUAGE_TAMIL
& LANGUAGE_MASK_PRIMARY
:
545 sRet
= makeRepresentativeTextForScript(USCRIPT_TAMIL
);
547 case LANGUAGE_TELUGU
& LANGUAGE_MASK_PRIMARY
:
548 sRet
= makeRepresentativeTextForScript(USCRIPT_TELUGU
);
550 case LANGUAGE_KANNADA
& LANGUAGE_MASK_PRIMARY
:
551 sRet
= makeRepresentativeTextForScript(USCRIPT_KANNADA
);
553 case LANGUAGE_MALAYALAM
& LANGUAGE_MASK_PRIMARY
:
554 sRet
= makeRepresentativeTextForScript(USCRIPT_MALAYALAM
);
556 case LANGUAGE_THAI
& LANGUAGE_MASK_PRIMARY
:
557 sRet
= makeRepresentativeTextForScript(USCRIPT_THAI
);
559 case LANGUAGE_LAO
& LANGUAGE_MASK_PRIMARY
:
560 sRet
= makeRepresentativeTextForScript(USCRIPT_LAO
);
562 case LANGUAGE_GEORGIAN
& LANGUAGE_MASK_PRIMARY
:
563 sRet
= makeRepresentativeTextForScript(USCRIPT_GEORGIAN
);
565 case LANGUAGE_KOREAN
& LANGUAGE_MASK_PRIMARY
:
566 sRet
= makeRepresentativeTextForScript(USCRIPT_KOREAN
);
568 case LANGUAGE_TIBETAN
& LANGUAGE_MASK_PRIMARY
:
569 sRet
= makeRepresentativeTextForScript(USCRIPT_TIBETAN
);
571 case LANGUAGE_SYRIAC
& LANGUAGE_MASK_PRIMARY
:
572 sRet
= makeRepresentativeTextForScript(USCRIPT_SYRIAC
);
574 case LANGUAGE_SINHALESE_SRI_LANKA
& LANGUAGE_MASK_PRIMARY
:
575 sRet
= makeRepresentativeTextForScript(USCRIPT_SINHALA
);
577 case LANGUAGE_BURMESE
& LANGUAGE_MASK_PRIMARY
:
578 sRet
= makeRepresentativeTextForScript(USCRIPT_MYANMAR
);
580 case LANGUAGE_AMHARIC_ETHIOPIA
& LANGUAGE_MASK_PRIMARY
:
581 sRet
= makeRepresentativeTextForScript(USCRIPT_ETHIOPIC
);
583 case LANGUAGE_CHEROKEE_UNITED_STATES
& LANGUAGE_MASK_PRIMARY
:
584 sRet
= makeRepresentativeTextForScript(USCRIPT_CHEROKEE
);
586 case LANGUAGE_KHMER
& LANGUAGE_MASK_PRIMARY
:
587 sRet
= makeRepresentativeTextForScript(USCRIPT_KHMER
);
589 case LANGUAGE_MONGOLIAN
& LANGUAGE_MASK_PRIMARY
:
590 sRet
= makeRepresentativeTextForScript(USCRIPT_MONGOLIAN
);
592 case LANGUAGE_JAPANESE
& LANGUAGE_MASK_PRIMARY
:
593 sRet
= makeRepresentativeTextForScript(USCRIPT_JAPANESE
);
595 case LANGUAGE_YI
& LANGUAGE_MASK_PRIMARY
:
596 sRet
= makeRepresentativeTextForScript(USCRIPT_YI
);
598 case LANGUAGE_GAELIC_IRELAND
& LANGUAGE_MASK_PRIMARY
:
600 const sal_Unicode aGa
[] = {
601 'T', 0x00E9, 'a', 'c', 's', ' ', 'S', 'a', 'm', 'p', 'l', 'a', 'c', 'h'
603 sRet
= OUString(aGa
, SAL_N_ELEMENTS(aGa
));
615 #if OSL_DEBUG_LEVEL > 2
616 void lcl_dump_unicode_coverage(const boost::dynamic_bitset
<sal_uInt32
> &rIn
)
620 fprintf(stderr
, "<NONE>\n");
623 if (rIn
[vcl::UnicodeCoverage::BASIC_LATIN
])
624 fprintf(stderr
, "BASIC_LATIN\n");
625 if (rIn
[vcl::UnicodeCoverage::LATIN_1_SUPPLEMENT
])
626 fprintf(stderr
, "LATIN_1_SUPPLEMENT\n");
627 if (rIn
[vcl::UnicodeCoverage::LATIN_EXTENDED_A
])
628 fprintf(stderr
, "LATIN_EXTENDED_A\n");
629 if (rIn
[vcl::UnicodeCoverage::LATIN_EXTENDED_B
])
630 fprintf(stderr
, "LATIN_EXTENDED_B\n");
631 if (rIn
[vcl::UnicodeCoverage::IPA_EXTENSIONS
])
632 fprintf(stderr
, "IPA_EXTENSIONS\n");
633 if (rIn
[vcl::UnicodeCoverage::SPACING_MODIFIER_LETTERS
])
634 fprintf(stderr
, "SPACING_MODIFIER_LETTERS\n");
635 if (rIn
[vcl::UnicodeCoverage::COMBINING_DIACRITICAL_MARKS
])
636 fprintf(stderr
, "COMBINING_DIACRITICAL_MARKS\n");
637 if (rIn
[vcl::UnicodeCoverage::GREEK_AND_COPTIC
])
638 fprintf(stderr
, "GREEK_AND_COPTIC\n");
639 if (rIn
[vcl::UnicodeCoverage::COPTIC
])
640 fprintf(stderr
, "COPTIC\n");
641 if (rIn
[vcl::UnicodeCoverage::CYRILLIC
])
642 fprintf(stderr
, "CYRILLIC\n");
643 if (rIn
[vcl::UnicodeCoverage::ARMENIAN
])
644 fprintf(stderr
, "ARMENIAN\n");
645 if (rIn
[vcl::UnicodeCoverage::HEBREW
])
646 fprintf(stderr
, "HEBREW\n");
647 if (rIn
[vcl::UnicodeCoverage::VAI
])
648 fprintf(stderr
, "VAI\n");
649 if (rIn
[vcl::UnicodeCoverage::ARABIC
])
650 fprintf(stderr
, "ARABIC\n");
651 if (rIn
[vcl::UnicodeCoverage::NKO
])
652 fprintf(stderr
, "NKO\n");
653 if (rIn
[vcl::UnicodeCoverage::DEVANAGARI
])
654 fprintf(stderr
, "DEVANAGARI\n");
655 if (rIn
[vcl::UnicodeCoverage::BENGALI
])
656 fprintf(stderr
, "BENGALI\n");
657 if (rIn
[vcl::UnicodeCoverage::GURMUKHI
])
658 fprintf(stderr
, "GURMUKHI\n");
659 if (rIn
[vcl::UnicodeCoverage::GUJARATI
])
660 fprintf(stderr
, "GUJARATI\n");
661 if (rIn
[vcl::UnicodeCoverage::ORIYA
])
662 fprintf(stderr
, "ORIYA\n");
663 if (rIn
[vcl::UnicodeCoverage::TAMIL
])
664 fprintf(stderr
, "TAMIL\n");
665 if (rIn
[vcl::UnicodeCoverage::TELUGU
])
666 fprintf(stderr
, "TELUGU\n");
667 if (rIn
[vcl::UnicodeCoverage::KANNADA
])
668 fprintf(stderr
, "KANNADA\n");
669 if (rIn
[vcl::UnicodeCoverage::MALAYALAM
])
670 fprintf(stderr
, "MALAYALAM\n");
671 if (rIn
[vcl::UnicodeCoverage::THAI
])
672 fprintf(stderr
, "THAI\n");
673 if (rIn
[vcl::UnicodeCoverage::LAO
])
674 fprintf(stderr
, "LAO\n");
675 if (rIn
[vcl::UnicodeCoverage::GEORGIAN
])
676 fprintf(stderr
, "GEORGIAN\n");
677 if (rIn
[vcl::UnicodeCoverage::BALINESE
])
678 fprintf(stderr
, "BALINESE\n");
679 if (rIn
[vcl::UnicodeCoverage::HANGUL_JAMO
])
680 fprintf(stderr
, "HANGUL_JAMO\n");
681 if (rIn
[vcl::UnicodeCoverage::LATIN_EXTENDED_ADDITIONAL
])
682 fprintf(stderr
, "LATIN_EXTENDED_ADDITIONAL\n");
683 if (rIn
[vcl::UnicodeCoverage::GREEK_EXTENDED
])
684 fprintf(stderr
, "GREEK_EXTENDED\n");
685 if (rIn
[vcl::UnicodeCoverage::GENERAL_PUNCTUATION
])
686 fprintf(stderr
, "GENERAL_PUNCTUATION\n");
687 if (rIn
[vcl::UnicodeCoverage::SUPERSCRIPTS_AND_SUBSCRIPTS
])
688 fprintf(stderr
, "SUPERSCRIPTS_AND_SUBSCRIPTS\n");
689 if (rIn
[vcl::UnicodeCoverage::CURRENCY_SYMBOLS
])
690 fprintf(stderr
, "CURRENCY_SYMBOLS\n");
691 if (rIn
[vcl::UnicodeCoverage::COMBINING_DIACRITICAL_MARKS_FOR_SYMBOLS
])
692 fprintf(stderr
, "COMBINING_DIACRITICAL_MARKS_FOR_SYMBOLS\n");
693 if (rIn
[vcl::UnicodeCoverage::LETTERLIKE_SYMBOLS
])
694 fprintf(stderr
, "LETTERLIKE_SYMBOLS\n");
695 if (rIn
[vcl::UnicodeCoverage::NUMBER_FORMS
])
696 fprintf(stderr
, "NUMBER_FORMS\n");
697 if (rIn
[vcl::UnicodeCoverage::ARROWS
])
698 fprintf(stderr
, "ARROWS\n");
699 if (rIn
[vcl::UnicodeCoverage::MATHEMATICAL_OPERATORS
])
700 fprintf(stderr
, "MATHEMATICAL_OPERATORS\n");
701 if (rIn
[vcl::UnicodeCoverage::MISCELLANEOUS_TECHNICAL
])
702 fprintf(stderr
, "MISCELLANEOUS_TECHNICAL\n");
703 if (rIn
[vcl::UnicodeCoverage::CONTROL_PICTURES
])
704 fprintf(stderr
, "CONTROL_PICTURES\n");
705 if (rIn
[vcl::UnicodeCoverage::OPTICAL_CHARACTER_RECOGNITION
])
706 fprintf(stderr
, "OPTICAL_CHARACTER_RECOGNITION\n");
707 if (rIn
[vcl::UnicodeCoverage::ENCLOSED_ALPHANUMERICS
])
708 fprintf(stderr
, "ENCLOSED_ALPHANUMERICS\n");
709 if (rIn
[vcl::UnicodeCoverage::BOX_DRAWING
])
710 fprintf(stderr
, "BOX_DRAWING\n");
711 if (rIn
[vcl::UnicodeCoverage::BLOCK_ELEMENTS
])
712 fprintf(stderr
, "BLOCK_ELEMENTS\n");
713 if (rIn
[vcl::UnicodeCoverage::GEOMETRIC_SHAPES
])
714 fprintf(stderr
, "GEOMETRIC_SHAPES\n");
715 if (rIn
[vcl::UnicodeCoverage::MISCELLANEOUS_SYMBOLS
])
716 fprintf(stderr
, "MISCELLANEOUS_SYMBOLS\n");
717 if (rIn
[vcl::UnicodeCoverage::DINGBATS
])
718 fprintf(stderr
, "DINGBATS\n");
719 if (rIn
[vcl::UnicodeCoverage::CJK_SYMBOLS_AND_PUNCTUATION
])
720 fprintf(stderr
, "CJK_SYMBOLS_AND_PUNCTUATION\n");
721 if (rIn
[vcl::UnicodeCoverage::HIRAGANA
])
722 fprintf(stderr
, "HIRAGANA\n");
723 if (rIn
[vcl::UnicodeCoverage::KATAKANA
])
724 fprintf(stderr
, "KATAKANA\n");
725 if (rIn
[vcl::UnicodeCoverage::BOPOMOFO
])
726 fprintf(stderr
, "BOPOMOFO\n");
727 if (rIn
[vcl::UnicodeCoverage::HANGUL_COMPATIBILITY_JAMO
])
728 fprintf(stderr
, "HANGUL_COMPATIBILITY_JAMO\n");
729 if (rIn
[vcl::UnicodeCoverage::PHAGS_PA
])
730 fprintf(stderr
, "PHAGS_PA\n");
731 if (rIn
[vcl::UnicodeCoverage::ENCLOSED_CJK_LETTERS_AND_MONTHS
])
732 fprintf(stderr
, "ENCLOSED_CJK_LETTERS_AND_MONTHS\n");
733 if (rIn
[vcl::UnicodeCoverage::CJK_COMPATIBILITY
])
734 fprintf(stderr
, "CJK_COMPATIBILITY\n");
735 if (rIn
[vcl::UnicodeCoverage::HANGUL_SYLLABLES
])
736 fprintf(stderr
, "HANGUL_SYLLABLES\n");
737 if (rIn
[vcl::UnicodeCoverage::NONPLANE_0
])
738 fprintf(stderr
, "NONPLANE_0\n");
739 if (rIn
[vcl::UnicodeCoverage::PHOENICIAN
])
740 fprintf(stderr
, "PHOENICIAN\n");
741 if (rIn
[vcl::UnicodeCoverage::CJK_UNIFIED_IDEOGRAPHS
])
742 fprintf(stderr
, "CJK_UNIFIED_IDEOGRAPHS\n");
743 if (rIn
[vcl::UnicodeCoverage::PRIVATE_USE_AREA_PLANE_0
])
744 fprintf(stderr
, "PRIVATE_USE_AREA_PLANE_0\n");
745 if (rIn
[vcl::UnicodeCoverage::CJK_STROKES
])
746 fprintf(stderr
, "CJK_STROKES\n");
747 if (rIn
[vcl::UnicodeCoverage::ALPHABETIC_PRESENTATION_FORMS
])
748 fprintf(stderr
, "ALPHABETIC_PRESENTATION_FORMS\n");
749 if (rIn
[vcl::UnicodeCoverage::ARABIC_PRESENTATION_FORMS_A
])
750 fprintf(stderr
, "ARABIC_PRESENTATION_FORMS_A\n");
751 if (rIn
[vcl::UnicodeCoverage::COMBINING_HALF_MARKS
])
752 fprintf(stderr
, "COMBINING_HALF_MARKS\n");
753 if (rIn
[vcl::UnicodeCoverage::VERTICAL_FORMS
])
754 fprintf(stderr
, "VERTICAL_FORMS\n");
755 if (rIn
[vcl::UnicodeCoverage::SMALL_FORM_VARIANTS
])
756 fprintf(stderr
, "SMALL_FORM_VARIANTS\n");
757 if (rIn
[vcl::UnicodeCoverage::ARABIC_PRESENTATION_FORMS_B
])
758 fprintf(stderr
, "ARABIC_PRESENTATION_FORMS_B\n");
759 if (rIn
[vcl::UnicodeCoverage::HALFWIDTH_AND_FULLWIDTH_FORMS
])
760 fprintf(stderr
, "HALFWIDTH_AND_FULLWIDTH_FORMS\n");
761 if (rIn
[vcl::UnicodeCoverage::SPECIALS
])
762 fprintf(stderr
, "SPECIALS\n");
763 if (rIn
[vcl::UnicodeCoverage::TIBETAN
])
764 fprintf(stderr
, "TIBETAN\n");
765 if (rIn
[vcl::UnicodeCoverage::SYRIAC
])
766 fprintf(stderr
, "SYRIAC\n");
767 if (rIn
[vcl::UnicodeCoverage::THAANA
])
768 fprintf(stderr
, "THAANA\n");
769 if (rIn
[vcl::UnicodeCoverage::SINHALA
])
770 fprintf(stderr
, "SINHALA\n");
771 if (rIn
[vcl::UnicodeCoverage::MYANMAR
])
772 fprintf(stderr
, "MYANMAR\n");
773 if (rIn
[vcl::UnicodeCoverage::ETHIOPIC
])
774 fprintf(stderr
, "ETHIOPIC\n");
775 if (rIn
[vcl::UnicodeCoverage::CHEROKEE
])
776 fprintf(stderr
, "CHEROKEE\n");
777 if (rIn
[vcl::UnicodeCoverage::UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS
])
778 fprintf(stderr
, "UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS\n");
779 if (rIn
[vcl::UnicodeCoverage::OGHAM
])
780 fprintf(stderr
, "OGHAM\n");
781 if (rIn
[vcl::UnicodeCoverage::RUNIC
])
782 fprintf(stderr
, "RUNIC\n");
783 if (rIn
[vcl::UnicodeCoverage::KHMER
])
784 fprintf(stderr
, "KHMER\n");
785 if (rIn
[vcl::UnicodeCoverage::MONGOLIAN
])
786 fprintf(stderr
, "MONGOLIAN\n");
787 if (rIn
[vcl::UnicodeCoverage::BRAILLE_PATTERNS
])
788 fprintf(stderr
, "BRAILLE_PATTERNS\n");
789 if (rIn
[vcl::UnicodeCoverage::YI_SYLLABLES
])
790 fprintf(stderr
, "YI_SYLLABLES\n");
791 if (rIn
[vcl::UnicodeCoverage::TAGALOG
])
792 fprintf(stderr
, "TAGALOG\n");
793 if (rIn
[vcl::UnicodeCoverage::OLD_ITALIC
])
794 fprintf(stderr
, "OLD_ITALIC\n");
795 if (rIn
[vcl::UnicodeCoverage::GOTHIC
])
796 fprintf(stderr
, "GOTHIC\n");
797 if (rIn
[vcl::UnicodeCoverage::DESERET
])
798 fprintf(stderr
, "DESERET\n");
799 if (rIn
[vcl::UnicodeCoverage::BYZANTINE_MUSICAL_SYMBOLS
])
800 fprintf(stderr
, "BYZANTINE_MUSICAL_SYMBOLS\n");
801 if (rIn
[vcl::UnicodeCoverage::MATHEMATICAL_ALPHANUMERIC_SYMBOLS
])
802 fprintf(stderr
, "MATHEMATICAL_ALPHANUMERIC_SYMBOLS\n");
803 if (rIn
[vcl::UnicodeCoverage::PRIVATE_USE_PLANE_15
])
804 fprintf(stderr
, "PRIVATE_USE_PLANE_15\n");
805 if (rIn
[vcl::UnicodeCoverage::VARIATION_SELECTORS
])
806 fprintf(stderr
, "VARIATION_SELECTORS\n");
807 if (rIn
[vcl::UnicodeCoverage::TAGS
])
808 fprintf(stderr
, "TAGS\n");
809 if (rIn
[vcl::UnicodeCoverage::LIMBU
])
810 fprintf(stderr
, "LIMBU\n");
811 if (rIn
[vcl::UnicodeCoverage::TAI_LE
])
812 fprintf(stderr
, "TAI_LE\n");
813 if (rIn
[vcl::UnicodeCoverage::NEW_TAI_LUE
])
814 fprintf(stderr
, "NEW_TAI_LUE\n");
815 if (rIn
[vcl::UnicodeCoverage::BUGINESE
])
816 fprintf(stderr
, "BUGINESE\n");
817 if (rIn
[vcl::UnicodeCoverage::GLAGOLITIC
])
818 fprintf(stderr
, "GLAGOLITIC\n");
819 if (rIn
[vcl::UnicodeCoverage::TIFINAGH
])
820 fprintf(stderr
, "TIFINAGH\n");
821 if (rIn
[vcl::UnicodeCoverage::YIJING_HEXAGRAM_SYMBOLS
])
822 fprintf(stderr
, "YIJING_HEXAGRAM_SYMBOLS\n");
823 if (rIn
[vcl::UnicodeCoverage::SYLOTI_NAGRI
])
824 fprintf(stderr
, "SYLOTI_NAGRI\n");
825 if (rIn
[vcl::UnicodeCoverage::LINEAR_B_SYLLABARY
])
826 fprintf(stderr
, "LINEAR_B_SYLLABARY\n");
827 if (rIn
[vcl::UnicodeCoverage::ANCIENT_GREEK_NUMBERS
])
828 fprintf(stderr
, "ANCIENT_GREEK_NUMBERS\n");
829 if (rIn
[vcl::UnicodeCoverage::UGARITIC
])
830 fprintf(stderr
, "UGARITIC\n");
831 if (rIn
[vcl::UnicodeCoverage::OLD_PERSIAN
])
832 fprintf(stderr
, "OLD_PERSIAN\n");
833 if (rIn
[vcl::UnicodeCoverage::SHAVIAN
])
834 fprintf(stderr
, "SHAVIAN\n");
835 if (rIn
[vcl::UnicodeCoverage::OSMANYA
])
836 fprintf(stderr
, "OSMANYA\n");
837 if (rIn
[vcl::UnicodeCoverage::CYPRIOT_SYLLABARY
])
838 fprintf(stderr
, "CYPRIOT_SYLLABARY\n");
839 if (rIn
[vcl::UnicodeCoverage::KHAROSHTHI
])
840 fprintf(stderr
, "KHAROSHTHI\n");
841 if (rIn
[vcl::UnicodeCoverage::TAI_XUAN_JING_SYMBOLS
])
842 fprintf(stderr
, "TAI_XUAN_JING_SYMBOLS\n");
843 if (rIn
[vcl::UnicodeCoverage::CUNEIFORM
])
844 fprintf(stderr
, "CUNEIFORM\n");
845 if (rIn
[vcl::UnicodeCoverage::COUNTING_ROD_NUMERALS
])
846 fprintf(stderr
, "COUNTING_ROD_NUMERALS\n");
847 if (rIn
[vcl::UnicodeCoverage::SUNDANESE
])
848 fprintf(stderr
, "SUNDANESE\n");
849 if (rIn
[vcl::UnicodeCoverage::LEPCHA
])
850 fprintf(stderr
, "LEPCHA\n");
851 if (rIn
[vcl::UnicodeCoverage::OL_CHIKI
])
852 fprintf(stderr
, "OL_CHIKI\n");
853 if (rIn
[vcl::UnicodeCoverage::SAURASHTRA
])
854 fprintf(stderr
, "SAURASHTRA\n");
855 if (rIn
[vcl::UnicodeCoverage::KAYAH_LI
])
856 fprintf(stderr
, "KAYAH_LI\n");
857 if (rIn
[vcl::UnicodeCoverage::REJANG
])
858 fprintf(stderr
, "REJANG\n");
859 if (rIn
[vcl::UnicodeCoverage::CHAM
])
860 fprintf(stderr
, "CHAM\n");
861 if (rIn
[vcl::UnicodeCoverage::ANCIENT_SYMBOLS
])
862 fprintf(stderr
, "ANCIENT_SYMBOLS\n");
863 if (rIn
[vcl::UnicodeCoverage::PHAISTOS_DISC
])
864 fprintf(stderr
, "PHAISTOS_DISC\n");
865 if (rIn
[vcl::UnicodeCoverage::CARIAN
])
866 fprintf(stderr
, "CARIAN\n");
867 if (rIn
[vcl::UnicodeCoverage::DOMINO_TILES
])
868 fprintf(stderr
, "DOMINO_TILES\n");
869 if (rIn
[vcl::UnicodeCoverage::RESERVED1
])
870 fprintf(stderr
, "RESERVED1\n");
871 if (rIn
[vcl::UnicodeCoverage::RESERVED2
])
872 fprintf(stderr
, "RESERVED2\n");
873 if (rIn
[vcl::UnicodeCoverage::RESERVED3
])
874 fprintf(stderr
, "RESERVED3\n");
875 if (rIn
[vcl::UnicodeCoverage::RESERVED4
])
876 fprintf(stderr
, "RESERVED4\n");
877 if (rIn
[vcl::UnicodeCoverage::RESERVED5
])
878 fprintf(stderr
, "RESERVED5\n");
881 void lcl_dump_codepage_coverage(const boost::dynamic_bitset
<sal_uInt32
> &rIn
)
885 fprintf(stderr
, "<NONE>\n");
888 if (rIn
[vcl::CodePageCoverage::CP1252
])
889 fprintf(stderr
, "CP1252\n");
890 if (rIn
[vcl::CodePageCoverage::CP1250
])
891 fprintf(stderr
, "CP1250\n");
892 if (rIn
[vcl::CodePageCoverage::CP1251
])
893 fprintf(stderr
, "CP1251\n");
894 if (rIn
[vcl::CodePageCoverage::CP1253
])
895 fprintf(stderr
, "CP1253\n");
896 if (rIn
[vcl::CodePageCoverage::CP1254
])
897 fprintf(stderr
, "CP1254\n");
898 if (rIn
[vcl::CodePageCoverage::CP1255
])
899 fprintf(stderr
, "CP1255\n");
900 if (rIn
[vcl::CodePageCoverage::CP1256
])
901 fprintf(stderr
, "CP1256\n");
902 if (rIn
[vcl::CodePageCoverage::CP1257
])
903 fprintf(stderr
, "CP1257\n");
904 if (rIn
[vcl::CodePageCoverage::CP1258
])
905 fprintf(stderr
, "CP1258\n");
906 if (rIn
[vcl::CodePageCoverage::CP874
])
907 fprintf(stderr
, "CP874\n");
908 if (rIn
[vcl::CodePageCoverage::CP932
])
909 fprintf(stderr
, "CP932\n");
910 if (rIn
[vcl::CodePageCoverage::CP936
])
911 fprintf(stderr
, "CP936\n");
912 if (rIn
[vcl::CodePageCoverage::CP949
])
913 fprintf(stderr
, "CP949\n");
914 if (rIn
[vcl::CodePageCoverage::CP950
])
915 fprintf(stderr
, "CP950\n");
916 if (rIn
[vcl::CodePageCoverage::CP1361
])
917 fprintf(stderr
, "CP1361\n");
918 if (rIn
[vcl::CodePageCoverage::CP869
])
919 fprintf(stderr
, "CP869\n");
920 if (rIn
[vcl::CodePageCoverage::CP866
])
921 fprintf(stderr
, "CP866\n");
922 if (rIn
[vcl::CodePageCoverage::CP865
])
923 fprintf(stderr
, "CP865\n");
924 if (rIn
[vcl::CodePageCoverage::CP864
])
925 fprintf(stderr
, "CP864\n");
926 if (rIn
[vcl::CodePageCoverage::CP863
])
927 fprintf(stderr
, "CP863\n");
928 if (rIn
[vcl::CodePageCoverage::CP862
])
929 fprintf(stderr
, "CP862\n");
930 if (rIn
[vcl::CodePageCoverage::CP861
])
931 fprintf(stderr
, "CP861\n");
932 if (rIn
[vcl::CodePageCoverage::CP860
])
933 fprintf(stderr
, "CP860\n");
934 if (rIn
[vcl::CodePageCoverage::CP857
])
935 fprintf(stderr
, "CP857\n");
936 if (rIn
[vcl::CodePageCoverage::CP855
])
937 fprintf(stderr
, "CP855\n");
938 if (rIn
[vcl::CodePageCoverage::CP852
])
939 fprintf(stderr
, "CP852\n");
940 if (rIn
[vcl::CodePageCoverage::CP775
])
941 fprintf(stderr
, "CP775\n");
942 if (rIn
[vcl::CodePageCoverage::CP737
])
943 fprintf(stderr
, "CP737\n");
944 if (rIn
[vcl::CodePageCoverage::CP780
])
945 fprintf(stderr
, "CP780\n");
946 if (rIn
[vcl::CodePageCoverage::CP850
])
947 fprintf(stderr
, "CP850\n");
948 if (rIn
[vcl::CodePageCoverage::CP437
])
949 fprintf(stderr
, "CP437\n");
953 boost::dynamic_bitset
<sal_uInt32
> getMaskByScriptType(sal_Int16 nScriptType
)
955 boost::dynamic_bitset
<sal_uInt32
> aMask(vcl::UnicodeCoverage::MAX_UC_ENUM
);
958 for (size_t i
= 0; i
< vcl::UnicodeCoverage::MAX_UC_ENUM
; ++i
)
960 using vcl::UnicodeCoverage::UnicodeCoverageEnum
;
961 UScriptCode eScriptCode
= otCoverageToScript(static_cast<UnicodeCoverageEnum
>(i
));
962 if (unicode::getScriptClassFromUScriptCode(eScriptCode
) == nScriptType
)
969 //false for all bits considered "Latin" by LibreOffice
970 boost::dynamic_bitset
<sal_uInt32
> getLatinMask()
972 static boost::dynamic_bitset
<sal_uInt32
> aMask(getMaskByScriptType(com::sun::star::i18n::ScriptType::LATIN
));
976 //false for all bits considered "Asian" by LibreOffice
977 boost::dynamic_bitset
<sal_uInt32
> getCJKMask()
979 static boost::dynamic_bitset
<sal_uInt32
> aMask(getMaskByScriptType(com::sun::star::i18n::ScriptType::ASIAN
));
983 //false for all bits considered "Complex" by LibreOffice
984 boost::dynamic_bitset
<sal_uInt32
> getCTLMask()
986 static boost::dynamic_bitset
<sal_uInt32
> aMask(getMaskByScriptType(com::sun::star::i18n::ScriptType::COMPLEX
));
990 //false for all bits considered "WEAK" by LibreOffice
991 boost::dynamic_bitset
<sal_uInt32
> getWeakMask()
993 static boost::dynamic_bitset
<sal_uInt32
> aMask(getMaskByScriptType(com::sun::star::i18n::ScriptType::WEAK
));
997 //Nearly every font supports some basic Latin
998 boost::dynamic_bitset
<sal_uInt32
> getCommonLatnSubsetMask()
1000 boost::dynamic_bitset
<sal_uInt32
> aMask(vcl::UnicodeCoverage::MAX_UC_ENUM
);
1002 aMask
.set(vcl::UnicodeCoverage::BASIC_LATIN
, false);
1003 aMask
.set(vcl::UnicodeCoverage::LATIN_1_SUPPLEMENT
, false);
1004 aMask
.set(vcl::UnicodeCoverage::LATIN_EXTENDED_A
, false);
1005 aMask
.set(vcl::UnicodeCoverage::LATIN_EXTENDED_B
, false);
1006 aMask
.set(vcl::UnicodeCoverage::LATIN_EXTENDED_ADDITIONAL
, false);
1010 UScriptCode
getScript(const vcl::FontCapabilities
&rFontCapabilities
)
1012 using vcl::UnicodeCoverage::UnicodeCoverageEnum
;
1014 boost::dynamic_bitset
<sal_uInt32
> aMasked
= rFontCapabilities
.maUnicodeRange
& getWeakMask();
1016 if (aMasked
.count() == 1)
1017 return otCoverageToScript(static_cast<UnicodeCoverageEnum
>(aMasked
.find_first()));
1019 if (aMasked
[vcl::UnicodeCoverage::ARABIC
])
1021 aMasked
.set(vcl::UnicodeCoverage::ARABIC_PRESENTATION_FORMS_A
, false);
1022 aMasked
.set(vcl::UnicodeCoverage::ARABIC_PRESENTATION_FORMS_B
, false);
1023 aMasked
.set(vcl::UnicodeCoverage::NKO
, false);
1024 //Probably strongly tuned for Arabic
1025 if (aMasked
.count() == 1)
1026 return USCRIPT_ARABIC
;
1027 if (aMasked
.count() == 2 && aMasked
[vcl::UnicodeCoverage::SYRIAC
])
1028 return USCRIPT_SYRIAC
;
1031 if (aMasked
[vcl::UnicodeCoverage::DEVANAGARI
])
1033 aMasked
.set(vcl::UnicodeCoverage::DEVANAGARI
, false);
1034 //Probably strongly tuned for a single Indic script
1035 if (aMasked
.count() == 1)
1036 return otCoverageToScript(static_cast<UnicodeCoverageEnum
>(aMasked
.find_first()));
1039 aMasked
.set(vcl::UnicodeCoverage::GREEK_EXTENDED
, false);
1040 aMasked
.set(vcl::UnicodeCoverage::GREEK_AND_COPTIC
, false);
1041 if (aMasked
.count() == 1)
1042 return otCoverageToScript(static_cast<UnicodeCoverageEnum
>(aMasked
.find_first()));
1044 if (aMasked
[vcl::UnicodeCoverage::CYRILLIC
])
1046 //Probably strongly tuned for Georgian
1047 if (aMasked
.count() == 2 && aMasked
[vcl::UnicodeCoverage::GEORGIAN
])
1048 return USCRIPT_GEORGIAN
;
1051 aMasked
&= getCJKMask();
1053 aMasked
.set(vcl::UnicodeCoverage::CYRILLIC
, false);
1054 aMasked
.set(vcl::UnicodeCoverage::THAI
, false);
1055 aMasked
.set(vcl::UnicodeCoverage::DESERET
, false);
1056 aMasked
.set(vcl::UnicodeCoverage::PHAGS_PA
, false);
1058 //So, possibly a CJK font
1059 if (!aMasked
.count() && !rFontCapabilities
.maCodePageRange
.empty())
1061 boost::dynamic_bitset
<sal_uInt32
> aCJKCodePageMask(vcl::CodePageCoverage::MAX_CP_ENUM
);
1062 aCJKCodePageMask
.set(vcl::CodePageCoverage::CP932
);
1063 aCJKCodePageMask
.set(vcl::CodePageCoverage::CP936
);
1064 aCJKCodePageMask
.set(vcl::CodePageCoverage::CP949
);
1065 aCJKCodePageMask
.set(vcl::CodePageCoverage::CP950
);
1066 aCJKCodePageMask
.set(vcl::CodePageCoverage::CP1361
);
1067 boost::dynamic_bitset
<sal_uInt32
> aMaskedCodePage
=
1068 rFontCapabilities
.maCodePageRange
& aCJKCodePageMask
;
1070 if (aMaskedCodePage
[vcl::CodePageCoverage::CP1361
])
1072 aMaskedCodePage
.set(vcl::CodePageCoverage::CP949
);
1073 aMaskedCodePage
.set(vcl::CodePageCoverage::CP1361
, false);
1076 if (aMaskedCodePage
.count() == 1)
1078 if (aMaskedCodePage
[vcl::CodePageCoverage::CP932
])
1079 return USCRIPT_JAPANESE
;
1080 if (aMaskedCodePage
[vcl::CodePageCoverage::CP949
])
1081 return USCRIPT_KOREAN
;
1082 if (aMaskedCodePage
[vcl::CodePageCoverage::CP936
])
1083 return USCRIPT_SIMPLIFIED_HAN
;
1084 if (aMaskedCodePage
[vcl::CodePageCoverage::CP950
])
1085 return USCRIPT_TRADITIONAL_HAN
;
1088 if (aMaskedCodePage
.count())
1092 return USCRIPT_COMMON
;
1098 UScriptCode
attemptToDisambiguateHan(UScriptCode eScript
, OutputDevice
&rDevice
)
1100 //If we're a CJK font, see if we seem to be tuned for C, J or K
1101 if (eScript
== USCRIPT_HAN
)
1103 const Font
&rFont
= rDevice
.GetFont();
1105 bool bKore
= false, bJpan
= false, bHant
= false, bHans
= false;
1107 const sal_Unicode aKorean
[] = { 0x3131 };
1108 OUString
sKorean(aKorean
, SAL_N_ELEMENTS(aKorean
));
1109 if (STRING_LEN
== rDevice
.HasGlyphs(rFont
, sKorean
))
1112 const sal_Unicode aJapanese
[] = { 0x3007, 0x9F9D };
1113 OUString
sJapanese(aJapanese
, SAL_N_ELEMENTS(aJapanese
));
1114 if (STRING_LEN
== rDevice
.HasGlyphs(rFont
, sJapanese
))
1117 const sal_Unicode aTraditionalChinese
[] = { 0x570B };
1118 OUString
sTraditionalChinese(aTraditionalChinese
, SAL_N_ELEMENTS(aTraditionalChinese
));
1119 if (STRING_LEN
== rDevice
.HasGlyphs(rFont
, sTraditionalChinese
))
1122 const sal_Unicode aSimplifiedChinese
[] = { 0x56FD };
1123 OUString
sSimplifiedChinese(aSimplifiedChinese
, SAL_N_ELEMENTS(aSimplifiedChinese
));
1124 if (STRING_LEN
== rDevice
.HasGlyphs(rFont
, sSimplifiedChinese
))
1127 if (bKore
&& !bJpan
&& !bHans
)
1128 eScript
= USCRIPT_KOREAN
;
1129 else if (bJpan
&& !bKore
&& !bHant
)
1130 eScript
= USCRIPT_JAPANESE
;
1131 else if (bHant
&& !bHans
&& !bKore
&& !bJpan
)
1132 eScript
= USCRIPT_TRADITIONAL_HAN
;
1133 else if (bHans
&& !bHant
&& !bKore
&& !bJpan
)
1134 eScript
= USCRIPT_SIMPLIFIED_HAN
;
1135 //otherwise fall-through as USCRIPT_HAN and expect a combind Hant/Hans preview
1141 OUString
makeShortRepresentativeTextForSelectedFont(OutputDevice
&rDevice
)
1143 vcl::FontCapabilities aFontCapabilities
;
1144 if (!rDevice
.GetFontCapabilities(aFontCapabilities
))
1147 #if OSL_DEBUG_LEVEL > 2
1148 fprintf(stderr
, "font is %s\n",
1149 OUStringToOString(rDevice
.GetFont().GetName(), RTL_TEXTENCODING_UTF8
).getStr());
1150 lcl_dump_unicode_coverage(aFontCapabilities
.maUnicodeRange
);
1151 lcl_dump_codepage_coverage(aFontCapabilities
.maCodePageRange
);
1154 aFontCapabilities
.maUnicodeRange
&= getCommonLatnSubsetMask();
1156 //If this font is probably tuned to display a single non-Latin
1157 //script and the font name is itself in Latin, then show a small
1158 //chunk of representative text for that script
1159 UScriptCode eScript
= getScript(aFontCapabilities
);
1160 if (!eScript
!= USCRIPT_COMMON
)
1163 eScript
= attemptToDisambiguateHan(eScript
, rDevice
);
1165 OUString sSampleText
= makeShortRepresentativeTextForScript(eScript
);
1166 bool bHasSampleTextGlyphs
= (STRING_LEN
== rDevice
.HasGlyphs(rDevice
.GetFont(), sSampleText
));
1167 return bHasSampleTextGlyphs
? sSampleText
: OUString();
1170 UScriptCode
otCoverageToScript(vcl::UnicodeCoverage::UnicodeCoverageEnum eOTCoverage
)
1172 UScriptCode eRet
= USCRIPT_COMMON
;
1173 switch (eOTCoverage
)
1175 case vcl::UnicodeCoverage::BASIC_LATIN
:
1176 case vcl::UnicodeCoverage::LATIN_1_SUPPLEMENT
:
1177 case vcl::UnicodeCoverage::LATIN_EXTENDED_A
:
1178 case vcl::UnicodeCoverage::LATIN_EXTENDED_B
:
1179 eRet
= USCRIPT_LATIN
;
1181 case vcl::UnicodeCoverage::COMBINING_DIACRITICAL_MARKS
:
1182 eRet
= USCRIPT_INHERITED
;
1184 case vcl::UnicodeCoverage::GREEK_AND_COPTIC
:
1185 eRet
= USCRIPT_GREEK
;
1187 case vcl::UnicodeCoverage::COPTIC
:
1188 eRet
= USCRIPT_COPTIC
;
1190 case vcl::UnicodeCoverage::CYRILLIC
:
1191 eRet
= USCRIPT_CYRILLIC
;
1193 case vcl::UnicodeCoverage::ARMENIAN
:
1194 eRet
= USCRIPT_ARMENIAN
;
1196 case vcl::UnicodeCoverage::HEBREW
:
1197 eRet
= USCRIPT_HEBREW
;
1199 case vcl::UnicodeCoverage::VAI
:
1202 case vcl::UnicodeCoverage::ARABIC
:
1203 eRet
= USCRIPT_ARABIC
;
1205 case vcl::UnicodeCoverage::NKO
:
1208 case vcl::UnicodeCoverage::DEVANAGARI
:
1209 eRet
= USCRIPT_DEVANAGARI
;
1211 case vcl::UnicodeCoverage::BENGALI
:
1212 eRet
= USCRIPT_BENGALI
;
1214 case vcl::UnicodeCoverage::GURMUKHI
:
1215 eRet
= USCRIPT_GURMUKHI
;
1217 case vcl::UnicodeCoverage::GUJARATI
:
1218 eRet
= USCRIPT_GUJARATI
;
1220 case vcl::UnicodeCoverage::ORIYA
:
1221 eRet
= USCRIPT_ORIYA
;
1223 case vcl::UnicodeCoverage::TAMIL
:
1224 eRet
= USCRIPT_TAMIL
;
1226 case vcl::UnicodeCoverage::TELUGU
:
1227 eRet
= USCRIPT_TELUGU
;
1229 case vcl::UnicodeCoverage::KANNADA
:
1230 eRet
= USCRIPT_KANNADA
;
1232 case vcl::UnicodeCoverage::MALAYALAM
:
1233 eRet
= USCRIPT_MALAYALAM
;
1235 case vcl::UnicodeCoverage::THAI
:
1236 eRet
= USCRIPT_THAI
;
1238 case vcl::UnicodeCoverage::LAO
:
1241 case vcl::UnicodeCoverage::GEORGIAN
:
1242 eRet
= USCRIPT_GEORGIAN
;
1244 case vcl::UnicodeCoverage::BALINESE
:
1245 eRet
= USCRIPT_BALINESE
;
1247 case vcl::UnicodeCoverage::HANGUL_JAMO
:
1248 eRet
= USCRIPT_HANGUL
;
1250 case vcl::UnicodeCoverage::LATIN_EXTENDED_ADDITIONAL
:
1251 eRet
= USCRIPT_LATIN
;
1253 case vcl::UnicodeCoverage::GREEK_EXTENDED
:
1254 eRet
= USCRIPT_GREEK
;
1256 case vcl::UnicodeCoverage::CURRENCY_SYMBOLS
:
1257 eRet
= USCRIPT_SYMBOLS
;
1259 case vcl::UnicodeCoverage::COMBINING_DIACRITICAL_MARKS_FOR_SYMBOLS
:
1260 eRet
= USCRIPT_INHERITED
;
1262 case vcl::UnicodeCoverage::LETTERLIKE_SYMBOLS
:
1263 case vcl::UnicodeCoverage::NUMBER_FORMS
:
1264 case vcl::UnicodeCoverage::ARROWS
:
1265 eRet
= USCRIPT_SYMBOLS
;
1267 case vcl::UnicodeCoverage::MATHEMATICAL_OPERATORS
:
1268 eRet
= USCRIPT_MATHEMATICAL_NOTATION
;
1270 case vcl::UnicodeCoverage::MISCELLANEOUS_TECHNICAL
:
1271 case vcl::UnicodeCoverage::OPTICAL_CHARACTER_RECOGNITION
:
1272 case vcl::UnicodeCoverage::BOX_DRAWING
:
1273 case vcl::UnicodeCoverage::BLOCK_ELEMENTS
:
1274 case vcl::UnicodeCoverage::GEOMETRIC_SHAPES
:
1275 case vcl::UnicodeCoverage::MISCELLANEOUS_SYMBOLS
:
1276 case vcl::UnicodeCoverage::DINGBATS
:
1277 case vcl::UnicodeCoverage::CJK_SYMBOLS_AND_PUNCTUATION
:
1278 eRet
= USCRIPT_SYMBOLS
;
1280 case vcl::UnicodeCoverage::HIRAGANA
:
1281 eRet
= USCRIPT_HIRAGANA
;
1283 case vcl::UnicodeCoverage::KATAKANA
:
1284 eRet
= USCRIPT_KATAKANA
;
1286 case vcl::UnicodeCoverage::BOPOMOFO
:
1287 eRet
= USCRIPT_BOPOMOFO
;
1289 case vcl::UnicodeCoverage::HANGUL_COMPATIBILITY_JAMO
:
1290 eRet
= USCRIPT_HANGUL
;
1292 case vcl::UnicodeCoverage::PHAGS_PA
:
1293 eRet
= USCRIPT_PHAGS_PA
;
1295 case vcl::UnicodeCoverage::ENCLOSED_CJK_LETTERS_AND_MONTHS
:
1296 eRet
= USCRIPT_HANGUL
;
1298 case vcl::UnicodeCoverage::CJK_COMPATIBILITY
:
1301 case vcl::UnicodeCoverage::HANGUL_SYLLABLES
:
1302 eRet
= USCRIPT_HANGUL
;
1304 case vcl::UnicodeCoverage::PHOENICIAN
:
1305 eRet
= USCRIPT_PHOENICIAN
;
1307 case vcl::UnicodeCoverage::CJK_UNIFIED_IDEOGRAPHS
:
1308 case vcl::UnicodeCoverage::CJK_STROKES
:
1311 case vcl::UnicodeCoverage::ARABIC_PRESENTATION_FORMS_A
:
1312 eRet
= USCRIPT_ARABIC
;
1314 case vcl::UnicodeCoverage::COMBINING_HALF_MARKS
:
1315 eRet
= USCRIPT_INHERITED
;
1317 case vcl::UnicodeCoverage::ARABIC_PRESENTATION_FORMS_B
:
1318 eRet
= USCRIPT_ARABIC
;
1320 case vcl::UnicodeCoverage::TIBETAN
:
1321 eRet
= USCRIPT_TIBETAN
;
1323 case vcl::UnicodeCoverage::SYRIAC
:
1324 eRet
= USCRIPT_SYRIAC
;
1326 case vcl::UnicodeCoverage::THAANA
:
1327 eRet
= USCRIPT_THAANA
;
1329 case vcl::UnicodeCoverage::SINHALA
:
1330 eRet
= USCRIPT_SINHALA
;
1332 case vcl::UnicodeCoverage::MYANMAR
:
1333 eRet
= USCRIPT_MYANMAR
;
1335 case vcl::UnicodeCoverage::ETHIOPIC
:
1336 eRet
= USCRIPT_ETHIOPIC
;
1338 case vcl::UnicodeCoverage::CHEROKEE
:
1339 eRet
= USCRIPT_CHEROKEE
;
1341 case vcl::UnicodeCoverage::UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS
:
1342 eRet
= USCRIPT_CANADIAN_ABORIGINAL
;
1344 case vcl::UnicodeCoverage::OGHAM
:
1345 eRet
= USCRIPT_OGHAM
;
1347 case vcl::UnicodeCoverage::RUNIC
:
1348 eRet
= USCRIPT_RUNIC
;
1350 case vcl::UnicodeCoverage::KHMER
:
1351 eRet
= USCRIPT_KHMER
;
1353 case vcl::UnicodeCoverage::MONGOLIAN
:
1354 eRet
= USCRIPT_MONGOLIAN
;
1356 case vcl::UnicodeCoverage::BRAILLE_PATTERNS
:
1357 eRet
= USCRIPT_BRAILLE
;
1359 case vcl::UnicodeCoverage::YI_SYLLABLES
:
1362 case vcl::UnicodeCoverage::TAGALOG
:
1363 eRet
= USCRIPT_TAGALOG
;
1365 case vcl::UnicodeCoverage::OLD_ITALIC
:
1366 eRet
= USCRIPT_OLD_ITALIC
;
1368 case vcl::UnicodeCoverage::GOTHIC
:
1369 eRet
= USCRIPT_GOTHIC
;
1371 case vcl::UnicodeCoverage::DESERET
:
1372 eRet
= USCRIPT_DESERET
;
1374 case vcl::UnicodeCoverage::BYZANTINE_MUSICAL_SYMBOLS
:
1375 case vcl::UnicodeCoverage::MATHEMATICAL_ALPHANUMERIC_SYMBOLS
:
1376 case vcl::UnicodeCoverage::PRIVATE_USE_PLANE_15
:
1377 eRet
= USCRIPT_SYMBOLS
;
1379 case vcl::UnicodeCoverage::VARIATION_SELECTORS
:
1380 eRet
= USCRIPT_INHERITED
;
1382 case vcl::UnicodeCoverage::TAGS
:
1383 eRet
= USCRIPT_SYMBOLS
;
1385 case vcl::UnicodeCoverage::LIMBU
:
1386 eRet
= USCRIPT_LIMBU
;
1388 case vcl::UnicodeCoverage::TAI_LE
:
1389 eRet
= USCRIPT_TAI_LE
;
1391 case vcl::UnicodeCoverage::NEW_TAI_LUE
:
1392 eRet
= USCRIPT_NEW_TAI_LUE
;
1394 case vcl::UnicodeCoverage::BUGINESE
:
1395 eRet
= USCRIPT_BUGINESE
;
1397 case vcl::UnicodeCoverage::GLAGOLITIC
:
1398 eRet
= USCRIPT_GLAGOLITIC
;
1400 case vcl::UnicodeCoverage::TIFINAGH
:
1401 eRet
= USCRIPT_TIFINAGH
;
1403 case vcl::UnicodeCoverage::YIJING_HEXAGRAM_SYMBOLS
:
1404 eRet
= USCRIPT_SYMBOLS
;
1406 case vcl::UnicodeCoverage::SYLOTI_NAGRI
:
1407 eRet
= USCRIPT_SYLOTI_NAGRI
;
1409 case vcl::UnicodeCoverage::LINEAR_B_SYLLABARY
:
1410 eRet
= USCRIPT_LINEAR_B
;
1412 case vcl::UnicodeCoverage::ANCIENT_GREEK_NUMBERS
:
1413 eRet
= USCRIPT_GREEK
;
1415 case vcl::UnicodeCoverage::UGARITIC
:
1416 eRet
= USCRIPT_UGARITIC
;
1418 case vcl::UnicodeCoverage::OLD_PERSIAN
:
1419 eRet
= USCRIPT_OLD_PERSIAN
;
1421 case vcl::UnicodeCoverage::SHAVIAN
:
1422 eRet
= USCRIPT_SHAVIAN
;
1424 case vcl::UnicodeCoverage::OSMANYA
:
1425 eRet
= USCRIPT_OSMANYA
;
1427 case vcl::UnicodeCoverage::CYPRIOT_SYLLABARY
:
1428 eRet
= USCRIPT_CYPRIOT
;
1430 case vcl::UnicodeCoverage::KHAROSHTHI
:
1431 eRet
= USCRIPT_KHAROSHTHI
;
1433 case vcl::UnicodeCoverage::CUNEIFORM
:
1434 eRet
= USCRIPT_CUNEIFORM
;
1436 case vcl::UnicodeCoverage::SUNDANESE
:
1437 eRet
= USCRIPT_SUNDANESE
;
1439 case vcl::UnicodeCoverage::LEPCHA
:
1440 eRet
= USCRIPT_LEPCHA
;
1442 case vcl::UnicodeCoverage::OL_CHIKI
:
1443 eRet
= USCRIPT_OL_CHIKI
;
1445 case vcl::UnicodeCoverage::SAURASHTRA
:
1446 eRet
= USCRIPT_SAURASHTRA
;
1448 case vcl::UnicodeCoverage::KAYAH_LI
:
1449 eRet
= USCRIPT_KAYAH_LI
;
1451 case vcl::UnicodeCoverage::REJANG
:
1452 eRet
= USCRIPT_REJANG
;
1454 case vcl::UnicodeCoverage::CHAM
:
1455 eRet
= USCRIPT_CHAM
;
1457 case vcl::UnicodeCoverage::CARIAN
:
1458 eRet
= USCRIPT_CARIAN
;
1460 case vcl::UnicodeCoverage::DOMINO_TILES
:
1461 case vcl::UnicodeCoverage::TAI_XUAN_JING_SYMBOLS
:
1462 case vcl::UnicodeCoverage::COUNTING_ROD_NUMERALS
:
1463 case vcl::UnicodeCoverage::ANCIENT_SYMBOLS
:
1464 case vcl::UnicodeCoverage::PHAISTOS_DISC
:
1465 eRet
= USCRIPT_SYMBOLS
;
1467 case vcl::UnicodeCoverage::IPA_EXTENSIONS
:
1468 case vcl::UnicodeCoverage::SPECIALS
:
1469 case vcl::UnicodeCoverage::HALFWIDTH_AND_FULLWIDTH_FORMS
:
1470 case vcl::UnicodeCoverage::VERTICAL_FORMS
:
1471 case vcl::UnicodeCoverage::SMALL_FORM_VARIANTS
:
1472 case vcl::UnicodeCoverage::ALPHABETIC_PRESENTATION_FORMS
:
1473 case vcl::UnicodeCoverage::PRIVATE_USE_AREA_PLANE_0
:
1474 case vcl::UnicodeCoverage::NONPLANE_0
:
1475 case vcl::UnicodeCoverage::ENCLOSED_ALPHANUMERICS
:
1476 case vcl::UnicodeCoverage::CONTROL_PICTURES
:
1477 case vcl::UnicodeCoverage::SUPERSCRIPTS_AND_SUBSCRIPTS
:
1478 case vcl::UnicodeCoverage::GENERAL_PUNCTUATION
:
1479 case vcl::UnicodeCoverage::SPACING_MODIFIER_LETTERS
:
1480 case vcl::UnicodeCoverage::RESERVED1
:
1481 case vcl::UnicodeCoverage::RESERVED2
:
1482 case vcl::UnicodeCoverage::RESERVED3
:
1483 case vcl::UnicodeCoverage::RESERVED4
:
1484 case vcl::UnicodeCoverage::RESERVED5
:
1485 case vcl::UnicodeCoverage::MAX_UC_ENUM
:
1491 OUString
makeRepresentativeTextForFont(sal_Int16 nScriptType
, const Font
&rFont
)
1493 OUString
sRet(makeRepresentativeTextForLanguage(rFont
.GetLanguage()));
1495 VirtualDevice aDevice
;
1496 if (sRet
.isEmpty() || (STRING_LEN
!= aDevice
.HasGlyphs(rFont
, sRet
)))
1498 aDevice
.SetFont(rFont
);
1499 vcl::FontCapabilities aFontCapabilities
;
1500 if (aDevice
.GetFontCapabilities(aFontCapabilities
))
1502 #if OSL_DEBUG_LEVEL > 2
1503 lcl_dump_unicode_coverage(aFontCapabilities
.maUnicodeRange
);
1506 aFontCapabilities
.maUnicodeRange
&= getWeakMask();
1508 if (nScriptType
!= com::sun::star::i18n::ScriptType::ASIAN
)
1510 aFontCapabilities
.maUnicodeRange
&= getCJKMask();
1511 aFontCapabilities
.maCodePageRange
.clear();
1513 if (nScriptType
!= com::sun::star::i18n::ScriptType::LATIN
)
1514 aFontCapabilities
.maUnicodeRange
&= getLatinMask();
1515 if (nScriptType
!= com::sun::star::i18n::ScriptType::COMPLEX
)
1516 aFontCapabilities
.maUnicodeRange
&= getCTLMask();
1518 #if OSL_DEBUG_LEVEL > 2
1519 fprintf(stderr
, "minimal\n");
1520 lcl_dump_unicode_coverage(aFontCapabilities
.maUnicodeRange
);
1521 lcl_dump_codepage_coverage(aFontCapabilities
.maCodePageRange
);
1524 UScriptCode eScript
= getScript(aFontCapabilities
);
1526 if (nScriptType
== com::sun::star::i18n::ScriptType::ASIAN
)
1527 eScript
= attemptToDisambiguateHan(eScript
, aDevice
);
1529 sRet
= makeRepresentativeTextForScript(eScript
);
1534 if (nScriptType
== com::sun::star::i18n::ScriptType::COMPLEX
)
1536 sRet
= makeRepresentativeTextForScript(USCRIPT_HEBREW
);
1537 if (STRING_LEN
!= aDevice
.HasGlyphs(rFont
, sRet
))
1539 sRet
= makeMinimalTextForScript(USCRIPT_HEBREW
);
1540 if (STRING_LEN
!= aDevice
.HasGlyphs(rFont
, sRet
))
1541 sRet
= makeRepresentativeTextForScript(USCRIPT_ARABIC
);
1544 else if (nScriptType
== com::sun::star::i18n::ScriptType::LATIN
)
1545 sRet
= makeRepresentativeTextForScript(USCRIPT_LATIN
);
1552 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */