|
Lines 28-33
Link Here
|
| 28 |
#include "pangofc-fontmap.h" |
28 |
#include "pangofc-fontmap.h" |
| 29 |
#include "pangofc-private.h" |
29 |
#include "pangofc-private.h" |
| 30 |
#include "modules.h" |
30 |
#include "modules.h" |
|
|
31 |
#include "pango-utils.h" |
| 31 |
|
32 |
|
| 32 |
typedef struct _PangoFcCoverageKey PangoFcCoverageKey; |
33 |
typedef struct _PangoFcCoverageKey PangoFcCoverageKey; |
| 33 |
typedef struct _PangoFcFace PangoFcFace; |
34 |
typedef struct _PangoFcFace PangoFcFace; |
|
Lines 621-626
Link Here
|
| 621 |
return FALSE; |
622 |
return FALSE; |
| 622 |
} |
623 |
} |
| 623 |
|
624 |
|
|
|
625 |
#if defined (FC_FAMILYLANG) || defined (FC_STYLELANG) |
| 626 |
static FcResult |
| 627 |
get_pattern_string_for_language (FcPattern *p, const char *language, const char *obj, const char *objlang, FcChar8 **s) |
| 628 |
{ |
| 629 |
int i, idx=0; |
| 630 |
FcChar8 *lang; |
| 631 |
|
| 632 |
for (i = 1; FcPatternGetString (p, objlang, i, &lang) == FcResultMatch; ++i) |
| 633 |
if (strncmp ((const char*) language, (const char*) lang, strlen ((const char*)lang)) == 0) |
| 634 |
{ |
| 635 |
idx = i; |
| 636 |
break; |
| 637 |
} |
| 638 |
|
| 639 |
return FcPatternGetString (p, obj, idx, s); |
| 640 |
} |
| 641 |
#endif |
| 642 |
|
| 624 |
static void |
643 |
static void |
| 625 |
pango_fc_font_map_list_families (PangoFontMap *fontmap, |
644 |
pango_fc_font_map_list_families (PangoFontMap *fontmap, |
| 626 |
PangoFontFamily ***families, |
645 |
PangoFontFamily ***families, |
|
Lines 644-651
Link Here
|
| 644 |
|
663 |
|
| 645 |
if (priv->n_families < 0) |
664 |
if (priv->n_families < 0) |
| 646 |
{ |
665 |
{ |
|
|
666 |
#ifdef FC_FAMILYLANG |
| 667 |
FcObjectSet *os = FcObjectSetBuild (FC_FAMILY, FC_FAMILYLANG, FC_SPACING, NULL); |
| 668 |
const char *language = pango_language_to_string (pango_get_default_language ()); |
| 669 |
#else |
| 647 |
FcObjectSet *os = FcObjectSetBuild (FC_FAMILY, FC_SPACING, NULL); |
670 |
FcObjectSet *os = FcObjectSetBuild (FC_FAMILY, FC_SPACING, NULL); |
|
|
671 |
#endif |
| 648 |
FcPattern *pat = FcPatternCreate (); |
672 |
FcPattern *pat = FcPatternCreate (); |
|
|
673 |
|
| 649 |
/* use hash table to avoid duplicate listings if different faces in |
674 |
/* use hash table to avoid duplicate listings if different faces in |
| 650 |
* the same family have different spacing values */ |
675 |
* the same family have different spacing values */ |
| 651 |
GHashTable *temp_family_hash; |
676 |
GHashTable *temp_family_hash; |
|
Lines 664-671
Link Here
|
| 664 |
FcChar8 *s; |
689 |
FcChar8 *s; |
| 665 |
FcResult res; |
690 |
FcResult res; |
| 666 |
int spacing; |
691 |
int spacing; |
| 667 |
|
692 |
|
|
|
693 |
#ifdef FC_FAMILYLANG |
| 694 |
res = get_pattern_string_for_language (fontset->fonts[i], language, FC_FAMILY, FC_FAMILYLANG, &s); |
| 695 |
#else |
| 668 |
res = FcPatternGetString (fontset->fonts[i], FC_FAMILY, 0, (FcChar8 **) &s); |
696 |
res = FcPatternGetString (fontset->fonts[i], FC_FAMILY, 0, (FcChar8 **) &s); |
|
|
697 |
#endif |
| 669 |
g_assert (res == FcResultMatch); |
698 |
g_assert (res == FcResultMatch); |
| 670 |
|
699 |
|
| 671 |
res = FcPatternGetInteger (fontset->fonts[i], FC_SPACING, 0, &spacing); |
700 |
res = FcPatternGetInteger (fontset->fonts[i], FC_SPACING, 0, &spacing); |
|
Lines 1689-1695
Link Here
|
| 1689 |
NULL); |
1718 |
NULL); |
| 1690 |
|
1719 |
|
| 1691 |
g_assert (match_pattern); |
1720 |
g_assert (match_pattern); |
| 1692 |
|
1721 |
|
| 1693 |
result_pattern = FcFontMatch (NULL, match_pattern, &res); |
1722 |
result_pattern = FcFontMatch (NULL, match_pattern, &res); |
| 1694 |
if (result_pattern) |
1723 |
if (result_pattern) |
| 1695 |
{ |
1724 |
{ |
|
Lines 1887-1893
Link Here
|
| 1887 |
} |
1916 |
} |
| 1888 |
else |
1917 |
else |
| 1889 |
{ |
1918 |
{ |
|
|
1919 |
#ifdef FC_STYLELANG |
| 1920 |
FcObjectSet *os = FcObjectSetBuild (FC_STYLE, FC_STYLELANG, NULL); |
| 1921 |
const char *language = pango_language_to_string (pango_get_default_language ()); |
| 1922 |
#else |
| 1890 |
FcObjectSet *os = FcObjectSetBuild (FC_STYLE, NULL); |
1923 |
FcObjectSet *os = FcObjectSetBuild (FC_STYLE, NULL); |
|
|
1924 |
#endif |
| 1891 |
FcPattern *pat = FcPatternBuild (NULL, |
1925 |
FcPattern *pat = FcPatternBuild (NULL, |
| 1892 |
FC_FAMILY, FcTypeString, fcfamily->family_name, |
1926 |
FC_FAMILY, FcTypeString, fcfamily->family_name, |
| 1893 |
NULL); |
1927 |
NULL); |
|
Lines 1905-1911
Link Here
|
| 1905 |
FcChar8 *s; |
1939 |
FcChar8 *s; |
| 1906 |
FcResult res; |
1940 |
FcResult res; |
| 1907 |
|
1941 |
|
|
|
1942 |
#ifdef FC_STYLELANG |
| 1943 |
res = get_pattern_string_for_language (fontset->fonts[i], language, FC_STYLE, FC_STYLELANG, &s); |
| 1944 |
#else |
| 1908 |
res = FcPatternGetString (fontset->fonts[i], FC_STYLE, 0, &s); |
1945 |
res = FcPatternGetString (fontset->fonts[i], FC_STYLE, 0, &s); |
|
|
1946 |
#endif |
| 1947 |
|
| 1909 |
if (res != FcResultMatch) |
1948 |
if (res != FcResultMatch) |
| 1910 |
s = "Regular"; |
1949 |
s = "Regular"; |
| 1911 |
|
1950 |
|