Update iso639-2 language coverage info, fix Georgian orthography to

eliminate Mingrelian and Svan glyphs, use coverage for inclusion and
    OS/2 for Han exclusion, restructure fclang.c to use fclang.h from
    fc-lang dir
This commit is contained in:
Keith Packard 2002-07-08 07:31:53 +00:00
parent d6dabf3686
commit e50b9ae711
11 changed files with 2794 additions and 2961 deletions

View File

@ -1,4 +1,4 @@
XCOMM $XFree86: xc/lib/fontconfig/fc-lang/Imakefile,v 1.3 2002/07/07 19:18:51 keithp Exp $ XCOMM $XFree86: xc/lib/fontconfig/fc-lang/Imakefile,v 1.4 2002/07/07 19:30:52 keithp Exp $
#ifdef UseInstalled #ifdef UseInstalled
/* building outside the tree, use private defines */ /* building outside the tree, use private defines */
@ -13,8 +13,8 @@ LOCAL_LIBRARIES=FontconfigClientLibs
SRCS=fc-lang.c SRCS=fc-lang.c
OBJS=fc-lang.o OBJS=fc-lang.o
TARG=fclang.c TARG=fclang.h
TMPL=fclang.tmpl.c TMPL=fclang.tmpl.h
# #
# Basic ISO 639-1 two letter language names # Basic ISO 639-1 two letter language names
@ -26,7 +26,7 @@ ORTH1=ab.orth ar.orth az.orth ba.orth be.orth bg.orth bn.orth bo.orth br.orth\
mk.orth ml.orth mn.orth mo.orth mt.orth nl.orth no.orth oc.orth or.orth\ mk.orth ml.orth mn.orth mo.orth mt.orth nl.orth no.orth oc.orth or.orth\
pl.orth pt.orth rm.orth ro.orth ru.orth sh.orth si.orth sk.orth sl.orth\ pl.orth pt.orth rm.orth ro.orth ru.orth sh.orth si.orth sk.orth sl.orth\
sq.orth sr.orth sv.orth ta.orth te.orth th.orth tl.orth tr.orth uk.orth\ sq.orth sr.orth sv.orth ta.orth te.orth th.orth tl.orth tr.orth uk.orth\
vo.orth wa.orth yi.orth zh_cn.orth zh_tw.orth vo.orth wa.orth yi.orth zh_cn.orth zh_mo.orth zh_sg.orth zh_tw.orth
# #
# ISO 639-2 adds many more three letter language names # ISO 639-2 adds many more three letter language names

2624
fc-lang/fclang.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,130 +0,0 @@
/*
* $XFree86$
*
* Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "fcint.h"
typedef struct {
FcChar8 *lang;
FcCharSet charset;
} FcLangCharSet;
@@@
#define NUM_LANG_CHAR_SET (sizeof (fcLangCharSets) / sizeof (fcLangCharSets[0]))
FcBool
FcFreeTypeSetLang (FcPattern *pattern, FcCharSet *charset)
{
int i;
FcChar32 missing;
for (i = 0; i < NUM_LANG_CHAR_SET; i++)
{
missing = FcCharSetSubtractCount (&fcLangCharSets[i].charset, charset);
if (FcDebug() & FC_DBG_SCANV)
printf ("%s(%d) ", fcLangCharSets[i].lang, missing);
if (!missing && !FcFreeTypeHasLang (pattern, fcLangCharSets[i].lang))
if (!FcPatternAddString (pattern, FC_LANG, fcLangCharSets[i].lang))
return FcFalse;
}
if (FcDebug() & FC_DBG_SCANV)
printf ("\n");
return FcTrue;
}
FcLangResult
FcLangCompare (const FcChar8 *s1, const FcChar8 *s2)
{
const FcChar8 *orig_s1 = s1;
FcChar8 c1, c2;
FcLangResult result;
/*
* Compare ISO 639 language codes
*/
for (;;)
{
c1 = *s1++;
c2 = *s2++;
if (c1 == '\0' || c1 == '-')
break;
if (c2 == '\0' || c2 == '-')
break;
c1 = FcToLower (c1);
c2 = FcToLower (c2);
if (c1 != c2)
return FcLangDifferentLang; /* mismatching lang code */
}
if (!c1 && !c2)
return FcLangEqual;
/*
* Make x-* mismatch as if the lang part didn't match
*/
result = FcLangDifferentCountry;
if (orig_s1[0] == 'x' && (orig_s1[1] == '\0' || orig_s1[1] == '-'))
result = FcLangDifferentLang;
if (c1 == '\0' || c2 == '\0')
return result;
/*
* Compare ISO 3166 country codes
*/
for (;;)
{
c1 = *s1++;
c2 = *s2++;
if (!c1 || !c2)
break;
c1 = FcToLower (c1);
c2 = FcToLower (c2);
if (c1 != c2)
break;
}
if (c1 == c2)
return FcLangEqual;
else
return result;
}
const FcCharSet *
FcCharSetForLang (const FcChar8 *lang)
{
int i;
int country = -1;
for (i = 0; i < NUM_LANG_CHAR_SET; i++)
{
switch (FcLangCompare (lang, fcLangCharSets[i].lang)) {
case FcLangEqual:
return &fcLangCharSets[i].charset;
case FcLangDifferentCountry:
if (country == -1)
country = i;
default:
break;
}
}
if (country == -1)
return 0;
return &fcLangCharSets[i].charset;
}

25
fc-lang/fclang.tmpl.h Normal file
View File

@ -0,0 +1,25 @@
/*
* $XFree86: xc/lib/fontconfig/fc-lang/fclang.tmpl.h,v 1.1 2002/07/06 23:21:36 keithp Exp $
*
* Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
@@@

View File

@ -14,7 +14,7 @@ built.
afr af Afrikaans afrikaans afr af Afrikaans afrikaans
aka Akan akan aka Akan akan
akk Akkadian akkadien akk Akkadian akkadien
alb/sqi* sq Albanian albanais * alb/sqi* sq Albanian albanais
ale Aleut aléoute ale Aleut aléoute
alg Algonquian languages algonquines, langues alg Algonquian languages algonquines, langues
amh am Amharic amharique amh am Amharic amharique
@ -22,7 +22,7 @@ built.
apa Apache languages apache apa Apache languages apache
* ara ar Arabic arabe * ara ar Arabic arabe
arc Aramaic araméen arc Aramaic araméen
arm/hye* hy Armenian arménien * arm/hye* hy Armenian arménien
arn Araucanian araucan arn Araucanian araucan
arp Arapaho arapaho arp Arapaho arapaho
art Artificial (Other) artificielles, autres langues art Artificial (Other) artificielles, autres langues
@ -42,7 +42,7 @@ built.
bal Baluchi baloutchi bal Baluchi baloutchi
bam Bambara bambara bam Bambara bambara
ban Balinese balinais ban Balinese balinais
baq/eus* eu Basque basque * baq/eus* eu Basque basque
bas Basa basa bas Basa basa
bat Baltic (Other) baltiques, autres langues bat Baltic (Other) baltiques, autres langues
bej Beja bedja bej Beja bedja
@ -57,7 +57,7 @@ built.
bis bi Bislama bichlamar bis bi Bislama bichlamar
bla Siksika blackfoot bla Siksika blackfoot
bnt Bantu (Other) bantoues, autres langues bnt Bantu (Other) bantoues, autres langues
tib/bod* bo Tibetan tibétain * tib/bod* bo Tibetan tibétain
bos bs Bosnian bosniaque bos bs Bosnian bosniaque
bra Braj braj bra Braj braj
* bre br Breton breton * bre br Breton breton
@ -73,12 +73,12 @@ built.
cau Caucasian (Other) caucasiennes, autres langues cau Caucasian (Other) caucasiennes, autres langues
ceb Cebuano cebuano ceb Cebuano cebuano
cel Celtic (Other) celtiques, autres langues cel Celtic (Other) celtiques, autres langues
cze/ces* cs Czech tchèque * cze/ces* cs Czech tchèque
cha ch Chamorro chamorro cha ch Chamorro chamorro
chb Chibcha chibcha chb Chibcha chibcha
che ce Chechen tchétchène che ce Chechen tchétchène
chg Chagatai djaghataï chg Chagatai djaghataï
chi/zho* zh Chinese chinois * chi/zho* zh Chinese chinois
chk Chuukese chuuk chk Chuukese chuuk
chm Mari mari chm Mari mari
chn Chinook jargon chinook, jargon chn Chinook jargon chinook, jargon
@ -113,7 +113,7 @@ built.
dra Dravidian (Other) dravidiennes, autres langues dra Dravidian (Other) dravidiennes, autres langues
dua Duala douala dua Duala douala
dum Dutch, Middle (ca.1050-1350) néerlandais moyen (ca. 1050-1350) dum Dutch, Middle (ca.1050-1350) néerlandais moyen (ca. 1050-1350)
dut/nld* nl Dutch néerlandais * dut/nld* nl Dutch néerlandais
dyu Dyula dioula dyu Dyula dioula
dzo dz Dzongkha dzongkha dzo dz Dzongkha dzongkha
efi Efik efik efi Efik efik
@ -146,8 +146,8 @@ built.
gay Gayo gayo gay Gayo gayo
gba Gbaya gbaya gba Gbaya gbaya
gem Germanic (Other) germaniques, autres langues gem Germanic (Other) germaniques, autres langues
geo/kat* ka Georgian géorgien * geo/kat* ka Georgian géorgien
ger/deu* de German allemand * ger/deu* de German allemand
gez Geez guèze gez Geez guèze
gil Gilbertese kiribati gil Gilbertese kiribati
* gla gd Gaelic; Scottish Gaelic gaélique; gaélique écossais * gla gd Gaelic; Scottish Gaelic gaélique; gaélique écossais
@ -161,7 +161,7 @@ built.
got Gothic gothique got Gothic gothique
grb Grebo grebo grb Grebo grebo
grc Greek, Ancient (to 1453) grec ancien (jusqu'à 1453) grc Greek, Ancient (to 1453) grec ancien (jusqu'à 1453)
gre/ell* el Greek, Modern (1453-) grec moderne (après 1453) * gre/ell* el Greek, Modern (1453-) grec moderne (après 1453)
grn gn Guarani guarani grn gn Guarani guarani
* guj gu Gujarati goudjrati * guj gu Gujarati goudjrati
gwi Gwich´in gwich´in gwi Gwich´in gwich´in
@ -195,7 +195,7 @@ built.
ipk ik Inupiaq inupiaq ipk ik Inupiaq inupiaq
ira Iranian (Other) iraniennes, autres langues ira Iranian (Other) iraniennes, autres langues
iro Iroquoian languages iroquoises, langues (famille) iro Iroquoian languages iroquoises, langues (famille)
ice/isl* is Icelandic islandais * ice/isl* is Icelandic islandais
* ita it Italian italien * ita it Italian italien
jav jv Javanese javanais jav jv Javanese javanais
* jpn ja Japanese japonais * jpn ja Japanese japonais
@ -271,7 +271,7 @@ built.
mic Micmac micmac mic Micmac micmac
min Minangkabau minangkabau min Minangkabau minangkabau
mis Miscellaneous languages diverses, langues mis Miscellaneous languages diverses, langues
mac/mkd* mk Macedonian macédonien * mac/mkd* mk Macedonian macédonien
mkh Mon-Khmer (Other) môn-khmer, autres langues mkh Mon-Khmer (Other) môn-khmer, autres langues
mlg mg Malagasy malgache mlg mg Malagasy malgache
* mlt mt Maltese maltais * mlt mt Maltese maltais
@ -361,9 +361,9 @@ built.
san sa Sanskrit sanskrit san sa Sanskrit sanskrit
sas Sasak sasak sas Sasak sasak
sat Santali santal sat Santali santal
scc/srp* sr Serbian serbe * scc/srp* sr Serbian serbe
sco Scots écossais sco Scots écossais
scr/hrv* hr Croatian croate * scr/hrv* hr Croatian croate
sel Selkup selkoupe sel Selkup selkoupe
sem Semitic (Other) sémitiques, autres langues sem Semitic (Other) sémitiques, autres langues
sga Irish, Old (to 900) irlandais ancien (jusqu'à 900) sga Irish, Old (to 900) irlandais ancien (jusqu'à 900)
@ -455,7 +455,7 @@ built.
was Washo washo was Washo washo
wel/cym* cy Welsh gallois wel/cym* cy Welsh gallois
wen Sorbian languages sorabes, langues wen Sorbian languages sorabes, langues
wln wa Walloon wallon * wln wa Walloon wallon
wol wo Wolof wolof wol wo Wolof wolof
xho xh Xhosa xhosa xho xh Xhosa xhosa
yao Yao yao yao Yao yao

View File

@ -1,5 +1,5 @@
# #
# $XFree86$ # $XFree86: xc/lib/fontconfig/fc-lang/ka.orth,v 1.2 2002/07/06 23:59:16 keithp Exp $
# #
# Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. # Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
# #
@ -24,7 +24,8 @@
# Georgian (KA) # Georgian (KA)
0589 # Armenian full stop (vertsaket) 0589 # Armenian full stop (vertsaket)
10a0-10c5 10a0-10c5
10d0-10f8 10d0-10f6
#10f7-10f8 # additional letters for Mingrelian and Svan
10fb 10fb
#2018 # single quote #2018 # single quote
#201a # single quote #201a # single quote

27
fc-lang/zh_mo.orth Normal file
View File

@ -0,0 +1,27 @@
#
# $XFree86$
#
# Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of Keith Packard not be used in
# advertising or publicity pertaining to distribution of the software without
# specific, written prior permission. Keith Packard makes no
# representations about the suitability of this software for any purpose. It
# is provided "as is" without express or implied warranty.
#
# KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
# EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
#
# Chinese in Macau (ZH-MO)
#
# Just use Big5 as for ZH-TW
include zh_tw.orth

27
fc-lang/zh_sg.orth Normal file
View File

@ -0,0 +1,27 @@
#
# $XFree86$
#
# Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of Keith Packard not be used in
# advertising or publicity pertaining to distribution of the software without
# specific, written prior permission. Keith Packard makes no
# representations about the suitability of this software for any purpose. It
# is provided "as is" without express or implied warranty.
#
# KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
# EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
#
# Chinese in Singapore (ZH-SG)
#
# Just use GB2312 as for ZH-CH
include zh_cn.orth

View File

@ -1,5 +1,5 @@
/* /*
* $XFree86: xc/lib/fontconfig/src/fcfreetype.c,v 1.5 2002/06/29 20:31:02 keithp Exp $ * $XFree86: xc/lib/fontconfig/src/fcfreetype.c,v 1.6 2002/07/06 23:47:43 keithp Exp $
* *
* Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
* *
@ -30,198 +30,33 @@
#include <freetype/internal/ftobjs.h> #include <freetype/internal/ftobjs.h>
#include <freetype/tttables.h> #include <freetype/tttables.h>
static const FcChar8 *fcLangLatin1[] = {
(FcChar8 *) "br", /* Breton */
(FcChar8 *) "ca", /* Catalan */
(FcChar8 *) "da", /* Danish */
(FcChar8 *) "de", /* German */
(FcChar8 *) "en", /* English */
(FcChar8 *) "es", /* Spanish */
(FcChar8 *) "eu", /* Basque */
(FcChar8 *) "fi", /* Finnish */
(FcChar8 *) "fo", /* Faroese */
(FcChar8 *) "fr", /* French */
(FcChar8 *) "ga", /* Irish */
(FcChar8 *) "gd", /* Scottish */
(FcChar8 *) "gl", /* Galician */
(FcChar8 *) "is", /* Islandic */
(FcChar8 *) "it", /* Italian */
(FcChar8 *) "kl", /* Greenlandic */
(FcChar8 *) "la", /* Latin */
(FcChar8 *) "nl", /* Dutch */
(FcChar8 *) "no", /* Norwegian */
(FcChar8 *) "pt", /* Portuguese */
(FcChar8 *) "rm", /* Rhaeto-Romanic */
(FcChar8 *) "sq", /* Albanian */
(FcChar8 *) "sv", /* Swedish */
0
};
static const FcChar8 *fcLangLatin2[] = {
(FcChar8 *) "cs", /* Czech */
(FcChar8 *) "de", /* German */
(FcChar8 *) "en", /* English */
(FcChar8 *) "fi", /* Finnish */
(FcChar8 *) "hr", /* Croatian */
(FcChar8 *) "hu", /* Hungarian */
(FcChar8 *) "la", /* Latin */
(FcChar8 *) "pl", /* Polish */
(FcChar8 *) "ro", /* Romanian */
(FcChar8 *) "sk", /* Slovak */
(FcChar8 *) "sl", /* Slovenian */
(FcChar8 *) "sq", /* Albanian */
0
};
static const FcChar8 *fcLangCyrillic[] = {
(FcChar8 *) "az", /* Azerbaijani */
(FcChar8 *) "ba", /* Bashkir */
(FcChar8 *) "bg", /* Bulgarian */
(FcChar8 *) "be", /* Byelorussian */
(FcChar8 *) "kk", /* Kazakh */
(FcChar8 *) "ky", /* Kirghiz */
(FcChar8 *) "mk", /* Macedonian */
(FcChar8 *) "mo", /* Moldavian */
(FcChar8 *) "mn", /* Mongolian */
(FcChar8 *) "ru", /* Russian */
(FcChar8 *) "sr", /* Serbian */
(FcChar8 *) "tg", /* Tadzhik */
(FcChar8 *) "tt", /* Tatar */
(FcChar8 *) "tk", /* Turkmen */
(FcChar8 *) "uz", /* Uzbek */
(FcChar8 *) "uk", /* Ukrainian */
0,
};
static const FcChar8 *fcLangGreek[] = {
(FcChar8 *) "el", /* Greek */
0
};
static const FcChar8 *fcLangTurkish[] = {
(FcChar8 *) "tr", /* Turkish */
0
};
static const FcChar8 *fcLangHebrew[] = {
(FcChar8 *) "he", /* Hebrew */
(FcChar8 *) "yi", /* Yiddish */
0
};
static const FcChar8 *fcLangArabic[] = {
(FcChar8 *) "ar", /* arabic */
0
};
static const FcChar8 *fcLangWindowsBaltic[] = {
(FcChar8 *) "da", /* Danish */
(FcChar8 *) "de", /* German */
(FcChar8 *) "en", /* English */
(FcChar8 *) "et", /* Estonian */
(FcChar8 *) "fi", /* Finnish */
(FcChar8 *) "la", /* Latin */
(FcChar8 *) "lt", /* Lithuanian */
(FcChar8 *) "lv", /* Latvian */
(FcChar8 *) "no", /* Norwegian */
(FcChar8 *) "pl", /* Polish */
(FcChar8 *) "sl", /* Slovenian */
(FcChar8 *) "sv", /* Swedish */
0
};
static const FcChar8 *fcLangVietnamese[] = {
(FcChar8 *) "vi", /* Vietnamese */
0,
};
static const FcChar8 *fcLangThai[] = {
(FcChar8 *) "th", /* Thai */
0,
};
static const FcChar8 *fcLangJapanese[] = {
(FcChar8 *) "ja", /* Japanese */
0,
};
static const FcChar8 *fcLangSimplifiedChinese[] = {
(FcChar8 *) "zh-cn", /* Chinese-China */
0,
};
static const FcChar8 *fcLangKorean[] = {
(FcChar8 *) "ko", /* Korean */
0,
};
static const FcChar8 *fcLangTraditionalChinese[] = {
(FcChar8 *) "zh-tw", /* Chinese-Taiwan */
0,
};
static const FcChar8 *fcLangEnglish[] = {
(FcChar8 *) "en", /* English */
0,
};
/* /*
* Elide some of the less useful bits * Keep Han languages separated by eliminating languages
* that the codePageRange bits says aren't supported
*/ */
static const struct { static const struct {
int bit; int bit;
const FcChar8 **lang; const FcChar8 *lang;
} FcCodePageRange[] = { } FcCodePageRange[] = {
{ 0, fcLangLatin1 }, { 17, (const FcChar8 *) "ja" },
{ 1, fcLangLatin2 }, { 18, (const FcChar8 *) "zh-tw" },
{ 2, fcLangCyrillic }, { 19, (const FcChar8 *) "ko" },
{ 3, fcLangGreek }, { 20, (const FcChar8 *) "zh-cn" },
{ 4, fcLangTurkish },
{ 5, fcLangHebrew },
{ 6, fcLangArabic },
{ 7, fcLangWindowsBaltic },
{ 8, fcLangVietnamese },
/* 9-15 reserved for Alternate ANSI */
{ 16, fcLangThai },
{ 17, fcLangJapanese },
{ 18, fcLangSimplifiedChinese },
{ 19, fcLangKorean },
{ 20, fcLangTraditionalChinese },
{ 21, fcLangKorean },
/* 22-28 reserved for Alternate ANSI & OEM */
/* { 29, fcLangMacintosh }, */
/* { 30, fcLangOem }, */
/* { 31, fcLangSymbol },*/
/* 32-47 reserved for OEM */
{ 48, fcLangGreek },
{ 49, fcLangCyrillic },
/* { 50, fcLangMsdosNordic }, */
{ 51, fcLangArabic },
/* { 52, fcLangMSDOS_CANADIAN_FRENCH }, */
{ 53, fcLangHebrew },
/* { 54, fcLangMSDOS_ICELANDIC }, */
/* { 55, fcLangMSDOS_PORTUGUESE }, */
{ 56, fcLangTurkish },
{ 57, fcLangCyrillic },
{ 58, fcLangLatin2 },
{ 59, fcLangWindowsBaltic },
{ 60, fcLangGreek },
{ 61, fcLangArabic },
{ 62, fcLangLatin1 },
{ 63, fcLangEnglish },
}; };
#define NUM_CODE_PAGE_RANGE (sizeof FcCodePageRange / sizeof FcCodePageRange[0]) #define NUM_CODE_PAGE_RANGE (sizeof FcCodePageRange / sizeof FcCodePageRange[0])
FcBool FcBool
FcFreeTypeHasLang (FcPattern *pattern, const FcChar8 *lang) FcFreeTypeIsExclusiveLang (const FcChar8 *lang)
{ {
FcChar8 *old; int i;
int i;
for (i = 0; FcPatternGetString (pattern, FC_LANG, i, &old) == FcResultMatch; i++) for (i = 0; i < NUM_CODE_PAGE_RANGE; i++)
if (!FcStrCmp (lang, old)) {
if (FcLangCompare (lang, FcCodePageRange[i].lang) != FcLangDifferentLang)
return FcTrue; return FcTrue;
}
return FcFalse; return FcFalse;
} }
@ -240,10 +75,7 @@ FcFreeTypeQuery (const FcChar8 *file,
FT_Library ftLibrary; FT_Library ftLibrary;
const FcChar8 *family; const FcChar8 *family;
TT_OS2 *os2; TT_OS2 *os2;
FcChar32 codepoints; const FcChar8 *exclusiveLang = 0;
FcChar8 *lang;
FcBool hasLang = FcFalse;
if (FT_Init_FreeType (&ftLibrary)) if (FT_Init_FreeType (&ftLibrary))
return 0; return 0;
@ -335,16 +167,17 @@ FcFreeTypeQuery (const FcChar8 *file,
} }
if (bits & (1 << bit)) if (bits & (1 << bit))
{ {
int j; /*
const FcChar8 *lang; * If the font advertises support for multiple
* "exclusive" languages, then include support
for (j = 0; (lang = FcCodePageRange[i].lang[j]); j++) * for any language found to have coverage
if (!FcFreeTypeHasLang (pat, lang)) */
{ if (exclusiveLang)
if (!FcPatternAddString (pat, FC_LANG, lang)) {
goto bail1; exclusiveLang = 0;
hasLang = FcTrue; break;
} }
exclusiveLang = FcCodePageRange[i].lang;
} }
} }
} }
@ -356,12 +189,11 @@ FcFreeTypeQuery (const FcChar8 *file,
if (!cs) if (!cs)
goto bail1; goto bail1;
codepoints = FcCharSetCount (cs);
/* /*
* Skip over PCF fonts that have no encoded characters; they're * Skip over PCF fonts that have no encoded characters; they're
* usually just Unicode fonts transcoded to some legacy encoding * usually just Unicode fonts transcoded to some legacy encoding
*/ */
if (codepoints == 0) if (FcCharSetCount (cs) == 0)
{ {
if (!strcmp(FT_MODULE_CLASS(&face->driver->root)->module_name, "pcf")) if (!strcmp(FT_MODULE_CLASS(&face->driver->root)->module_name, "pcf"))
goto bail2; goto bail2;
@ -370,18 +202,8 @@ FcFreeTypeQuery (const FcChar8 *file,
if (!FcPatternAddCharSet (pat, FC_CHARSET, cs)) if (!FcPatternAddCharSet (pat, FC_CHARSET, cs))
goto bail2; goto bail2;
if (!hasLang) if (!FcFreeTypeSetLang (pat, cs, exclusiveLang))
{ goto bail2;
if (!FcFreeTypeSetLang (pat, cs))
goto bail2;
/*
* Make sure it has a lang entry
*/
if (FcPatternGetString (pat, FC_LANG, 0, &lang) != FcResultMatch)
if (!FcPatternAddString (pat, FC_LANG, (FcChar8 *) "x-unknown"))
goto bail2;
}
/* /*
* Drop our reference to the charset * Drop our reference to the charset

View File

@ -1,5 +1,5 @@
/* /*
* $XFree86: xc/lib/fontconfig/src/fcint.h,v 1.13 2002/06/03 08:31:15 keithp Exp $ * $XFree86: xc/lib/fontconfig/src/fcint.h,v 1.16 2002/07/06 23:47:44 keithp Exp $
* *
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
* *
@ -398,6 +398,9 @@ int
FcFontDebug (void); FcFontDebug (void);
/* fcfreetype.c */ /* fcfreetype.c */
FcBool
FcFreeTypeIsExclusiveLang (const FcChar8 *lang);
FcBool FcBool
FcFreeTypeHasLang (FcPattern *pattern, const FcChar8 *lang); FcFreeTypeHasLang (FcPattern *pattern, const FcChar8 *lang);
@ -470,7 +473,9 @@ FcMemFree (int kind, int size);
/* fclang.c */ /* fclang.c */
FcBool FcBool
FcFreeTypeSetLang (FcPattern *pattern, FcCharSet *charset); FcFreeTypeSetLang (FcPattern *pattern,
FcCharSet *charset,
const FcChar8 *exclusiveLang);
FcLangResult FcLangResult
FcLangCompare (const FcChar8 *s1, const FcChar8 *s2); FcLangCompare (const FcChar8 *s1, const FcChar8 *s2);

File diff suppressed because it is too large Load Diff