Bugzilla – Attachment 17836 Details for
Bug 53228
Enhance pango to support artifical bold and italic
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
The patch.
pango-1.2.1-style-20030428.patch (text/plain), 4.71 KB, created by
Zhe Su
on 2004-04-04 00:24:40 UTC
(
hide
)
Description:
The patch.
Filename:
MIME Type:
Creator:
Zhe Su
Created:
2004-04-04 00:24:40 UTC
Size:
4.71 KB
patch
obsolete
>--- pango-1.2.1/pango/pangofc-fontmap.cI.orig 2002-12-17 10:07:36.000000000 +0800 >+++ pango-1.2.1/pango/pangofc-fontmap.cI 2003-04-28 11:10:08.000000000 +0800 >@@ -51,6 +51,11 @@ > > PangoFcFamily *family; > char *style; >+ /* Add by firefly@firefly.idv.tw >+ * ³oÓ¦¡¼Ë¦WºÙ¬O¼ÒÀÀªº¶Ü ? >+ * This style name is alias? (TRUE:yes, FALSE:no) >+ */ >+ int is_alias_style; > }; > > struct _PangoFcFamily >@@ -914,7 +919,13 @@ > FcPattern *match_pattern; > FcPattern *result_pattern; > >- if (is_alias_family (fcfamily->family_name)) >+ /* >+ * Add by firefly@firefly.idv.tw >+ * ¦pªG³oÓ¦r«¬¦WºÙ©Î¦¡¼Ë¬OµêÀÀªº, ´N¼ÒÀÀ¸Ó¦¡¼Ëªº±×Åé¡B²ÊÅé >+ * If this family name or style name is alias name. >+ * Makeup this style's "weight & slant". >+ */ >+ if (is_alias_family (fcfamily->family_name) || fcface->is_alias_style) > { > if (strcmp (fcface->style, "Regular") == 0) > return make_alias_description (fcfamily, FALSE, FALSE); >@@ -993,11 +1004,13 @@ > */ > static PangoFcFace * > create_face (PangoFcFamily *fcfamily, >- const char *style) >+ const char *style, >+ int is_alias_style) > { > PangoFcFace *face = g_object_new (PANGO_FC_TYPE_FACE, NULL); > face->style = g_strdup (style); > face->family = fcfamily; >+ face->is_alias_style = is_alias_style; > > return face; > } >@@ -1021,24 +1034,68 @@ > fcfamily->faces = g_new (PangoFcFace *, fcfamily->n_faces); > > i = 0; >- fcfamily->faces[i++] = create_face (fcfamily, "Regular"); >- fcfamily->faces[i++] = create_face (fcfamily, "Bold"); >- fcfamily->faces[i++] = create_face (fcfamily, "Italic"); >- fcfamily->faces[i++] = create_face (fcfamily, "Bold Italic"); >+ fcfamily->faces[i++] = create_face (fcfamily, "Regular", TRUE); >+ fcfamily->faces[i++] = create_face (fcfamily, "Bold", TRUE); >+ fcfamily->faces[i++] = create_face (fcfamily, "Italic", TRUE); >+ fcfamily->faces[i++] = create_face (fcfamily, "Bold Italic", TRUE); > } > else > { >- FcObjectSet *os = FcObjectSetBuild (FC_STYLE, NULL); >+ FcObjectSet *os = FcObjectSetBuild (FC_STYLE, FC_WEIGHT, FC_SLANT, NULL); > FcPattern *pat = FcPatternBuild (NULL, > FC_FAMILY, FcTypeString, fcfamily->family_name, > NULL); >+ >+ /*---------------------------------------------------------- >+ * Add by firefly@firefly.idv.tw >+ *---------------------------------------------------------*/ >+ #define ST_REGULAR 0 >+ #define ST_ITALIC 1 >+ #define ST_BOLD 2 >+ #define ST_BOLD_ITALIC 3 >+ int style_table[] = { FcFalse, FcFalse, FcFalse, FcFalse }; >+ int nstyle_alias = 0; >+ /*----------------------------------------------------------*/ > > fontset = FcFontList (NULL, pat, os); > > FcPatternDestroy (pat); > FcObjectSetDestroy (os); >- >- fcfamily->n_faces = fontset->nfont; >+ >+ /*---------------------------------------------------------- >+ * Add by firefly@firefly.idv.tw >+ * Àˬd³oÓ family ªº styles ¬O§_¦³¥|ºØ¦¡¼Ë >+ * Check this family's styles. >+ *---------------------------------------------------------*/ >+ for (i = 0; i < fontset->nfont; i++) >+ { >+ int weight, slant; >+ >+ if (FcPatternGetInteger(fontset->fonts[i], FC_WEIGHT, 0, &weight) != FcResultMatch) >+ weight = 0; >+ >+ if (FcPatternGetInteger(fontset->fonts[i], FC_SLANT, 0, &slant) != FcResultMatch) >+ slant = 0; >+ >+ if (weight <= FC_WEIGHT_MEDIUM && slant < FC_SLANT_ITALIC) >+ style_table[ST_REGULAR] = FcTrue; >+ else if (weight <= FC_WEIGHT_MEDIUM && slant >= FC_SLANT_ITALIC) >+ style_table[ST_ITALIC] = FcTrue; >+ else if (weight > FC_WEIGHT_MEDIUM && slant < FC_SLANT_ITALIC) >+ style_table[ST_BOLD] = FcTrue; >+ else if (weight > FC_WEIGHT_MEDIUM && slant >= FC_SLANT_ITALIC) >+ style_table[ST_BOLD_ITALIC] = FcTrue; >+ } >+ /* pºâ¯Ê¤Öªº Styles ¼Æ¥Ø*/ >+ for (i = 1 ; i < 4 ; i++) >+ { >+ if (!style_table[i]) >+ nstyle_alias++; >+ } >+ /*----------------------------------------------------------*/ >+ >+ /* ¯u¥¿ªº style ¼Æ¦A¥[¤W¯Ê¤Öªº style ¼Æ */ >+ fcfamily->n_faces = fontset->nfont + nstyle_alias; > fcfamily->faces = g_new (PangoFcFace *, fcfamily->n_faces); > > for (i = 0; i < fontset->nfont; i++) >@@ -1050,9 +1107,18 @@ > if (res != FcResultMatch) > s = "Regular"; > >- fcfamily->faces[i] = create_face (fcfamily, s); >+ fcfamily->faces[i] = create_face (fcfamily, s, FALSE); > } > >+ /* ¥[¤J¯Ê¤Öªº style */ >+ int k = fontset->nfont; >+ if (!style_table[ST_BOLD]) >+ fcfamily->faces[k++] = create_face (fcfamily, "Bold", TRUE); >+ if (!style_table[ST_ITALIC]) >+ fcfamily->faces[k++] = create_face (fcfamily, "Italic", TRUE); >+ if (!style_table[ST_BOLD_ITALIC]) >+ fcfamily->faces[k++] = create_face (fcfamily, "Bold Italic", TRUE); >+ > FcFontSetDestroy (fontset); > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 53228
:
17836
|
54869
|
61826
|
61827