View | Details | Raw Unified | Return to bug 53228
Collapse All | Expand All

(-)pango-1.2.1/pango/pangofc-fontmap.cI.orig (-10 / +76 lines)
Lines 51-56 Link Here
51
51
52
  PangoFcFamily *family;
52
  PangoFcFamily *family;
53
  char *style;
53
  char *style;
54
  /* Add by firefly@firefly.idv.tw
55
   * ³o­Ó¦¡¼Ë¦WºÙ¬O¼ÒÀÀªº¶Ü ?
56
   * This style name is alias? (TRUE:yes, FALSE:no)
57
   */
58
  int	is_alias_style;
54
};
59
};
55
60
56
struct _PangoFcFamily
61
struct _PangoFcFamily
Lines 914-920 Link Here
914
  FcPattern *match_pattern;
919
  FcPattern *match_pattern;
915
  FcPattern *result_pattern;
920
  FcPattern *result_pattern;
916
921
917
  if (is_alias_family (fcfamily->family_name))
922
  /*
923
   * Add by firefly@firefly.idv.tw
924
   * ¦pªG³o­Ó¦r«¬¦WºÙ©Î¦¡¼Ë¬OµêÀÀªº, ´N¼ÒÀÀ¸Ó¦¡¼Ëªº±×Åé¡B²ÊÅé
925
   * If this family name or style name is alias name.
926
   * Makeup this style's "weight & slant".
927
   */
928
  if (is_alias_family (fcfamily->family_name) || fcface->is_alias_style)
918
    {
929
    {
919
      if (strcmp (fcface->style, "Regular") == 0)
930
      if (strcmp (fcface->style, "Regular") == 0)
920
	return make_alias_description (fcfamily, FALSE, FALSE);
931
	return make_alias_description (fcfamily, FALSE, FALSE);
Lines 993-1003 Link Here
993
 */
1004
 */
994
static PangoFcFace *
1005
static PangoFcFace *
995
create_face (PangoFcFamily *fcfamily,
1006
create_face (PangoFcFamily *fcfamily,
996
	     const char     *style)
1007
	     const char     *style,
1008
	     int	is_alias_style)
997
{
1009
{
998
  PangoFcFace *face = g_object_new (PANGO_FC_TYPE_FACE, NULL);
1010
  PangoFcFace *face = g_object_new (PANGO_FC_TYPE_FACE, NULL);
999
  face->style = g_strdup (style);
1011
  face->style = g_strdup (style);
1000
  face->family = fcfamily;
1012
  face->family = fcfamily;
1013
  face->is_alias_style = is_alias_style;
1001
1014
1002
  return face;
1015
  return face;
1003
}
1016
}
Lines 1021-1044 Link Here
1021
	  fcfamily->faces = g_new (PangoFcFace *, fcfamily->n_faces);
1034
	  fcfamily->faces = g_new (PangoFcFace *, fcfamily->n_faces);
1022
1035
1023
	  i = 0;
1036
	  i = 0;
1024
	  fcfamily->faces[i++] = create_face (fcfamily, "Regular");
1037
	  fcfamily->faces[i++] = create_face (fcfamily, "Regular", TRUE);
1025
	  fcfamily->faces[i++] = create_face (fcfamily, "Bold");
1038
	  fcfamily->faces[i++] = create_face (fcfamily, "Bold", TRUE);
1026
	  fcfamily->faces[i++] = create_face (fcfamily, "Italic");
1039
	  fcfamily->faces[i++] = create_face (fcfamily, "Italic", TRUE);
1027
	  fcfamily->faces[i++] = create_face (fcfamily, "Bold Italic");
1040
	  fcfamily->faces[i++] = create_face (fcfamily, "Bold Italic", TRUE);
1028
	}
1041
	}
1029
      else
1042
      else
1030
	{
1043
	{
1031
	  FcObjectSet *os = FcObjectSetBuild (FC_STYLE, NULL);
1044
	  FcObjectSet *os = FcObjectSetBuild (FC_STYLE, FC_WEIGHT, FC_SLANT, NULL);
1032
	  FcPattern *pat = FcPatternBuild (NULL, 
1045
	  FcPattern *pat = FcPatternBuild (NULL, 
1033
					   FC_FAMILY, FcTypeString, fcfamily->family_name,
1046
					   FC_FAMILY, FcTypeString, fcfamily->family_name,
1034
					   NULL);
1047
					   NULL);
1048
	
1049
	  /*----------------------------------------------------------
1050
	   * Add by firefly@firefly.idv.tw
1051
	   *---------------------------------------------------------*/
1052
	  #define	ST_REGULAR     0
1053
	  #define	ST_ITALIC      1
1054
	  #define	ST_BOLD        2
1055
	  #define	ST_BOLD_ITALIC 3
1056
	  int	style_table[] = { FcFalse, FcFalse, FcFalse, FcFalse };
1057
	  int	nstyle_alias = 0;
1058
	 /*----------------------------------------------------------*/
1035
      
1059
      
1036
	  fontset = FcFontList (NULL, pat, os);
1060
	  fontset = FcFontList (NULL, pat, os);
1037
      
1061
      
1038
	  FcPatternDestroy (pat);
1062
	  FcPatternDestroy (pat);
1039
	  FcObjectSetDestroy (os);
1063
	  FcObjectSetDestroy (os);
1040
      
1064
	  
1041
	  fcfamily->n_faces = fontset->nfont;
1065
	  /*----------------------------------------------------------
1066
	   * Add by firefly@firefly.idv.tw
1067
	   * Àˬd³o­Ó family ªº styles ¬O§_¦³¥|ºØ¦¡¼Ë
1068
	   * Check this family's styles.
1069
	   *---------------------------------------------------------*/
1070
	  for (i = 0; i < fontset->nfont; i++)
1071
	    {
1072
	      int weight, slant;
1073
1074
	      if (FcPatternGetInteger(fontset->fonts[i], FC_WEIGHT, 0, &weight) != FcResultMatch)
1075
		weight = 0;
1076
1077
	      if (FcPatternGetInteger(fontset->fonts[i], FC_SLANT, 0, &slant) != FcResultMatch)
1078
		slant = 0;
1079
1080
	      if (weight <= FC_WEIGHT_MEDIUM && slant < FC_SLANT_ITALIC)
1081
		style_table[ST_REGULAR] = FcTrue;
1082
	      else if (weight <= FC_WEIGHT_MEDIUM && slant >= FC_SLANT_ITALIC)
1083
		style_table[ST_ITALIC] = FcTrue;
1084
	      else if (weight > FC_WEIGHT_MEDIUM && slant < FC_SLANT_ITALIC)
1085
		style_table[ST_BOLD] = FcTrue;
1086
	      else if (weight > FC_WEIGHT_MEDIUM && slant >= FC_SLANT_ITALIC)
1087
		style_table[ST_BOLD_ITALIC] = FcTrue;
1088
	    }
1089
          /* ­pºâ¯Ê¤Öªº Styles ¼Æ¥Ø*/
1090
	  for (i = 1 ; i < 4 ; i++)
1091
	    {
1092
		if (!style_table[i])
1093
			nstyle_alias++;
1094
	    }
1095
	 /*----------------------------------------------------------*/
1096
1097
	  /* ¯u¥¿ªº style ¼Æ¦A¥[¤W¯Ê¤Öªº style ¼Æ */
1098
	  fcfamily->n_faces = fontset->nfont + nstyle_alias;
1042
	  fcfamily->faces = g_new (PangoFcFace *, fcfamily->n_faces);
1099
	  fcfamily->faces = g_new (PangoFcFace *, fcfamily->n_faces);
1043
	  
1100
	  
1044
	  for (i = 0; i < fontset->nfont; i++)
1101
	  for (i = 0; i < fontset->nfont; i++)
Lines 1050-1058 Link Here
1050
	      if (res != FcResultMatch)
1107
	      if (res != FcResultMatch)
1051
		s = "Regular";
1108
		s = "Regular";
1052
1109
1053
	      fcfamily->faces[i] = create_face (fcfamily, s);
1110
	      fcfamily->faces[i] = create_face (fcfamily, s, FALSE);
1054
	    }
1111
	    }
1055
1112
1113
	  /* ¥[¤J¯Ê¤Öªº style */
1114
	  int k = fontset->nfont;
1115
	  if (!style_table[ST_BOLD])
1116
	      fcfamily->faces[k++] = create_face (fcfamily, "Bold", TRUE);
1117
	  if (!style_table[ST_ITALIC])
1118
	      fcfamily->faces[k++] = create_face (fcfamily, "Italic", TRUE);
1119
	  if (!style_table[ST_BOLD_ITALIC])
1120
	      fcfamily->faces[k++] = create_face (fcfamily, "Bold Italic", TRUE);
1121
1056
	  FcFontSetDestroy (fontset);
1122
	  FcFontSetDestroy (fontset);
1057
	}
1123
	}
1058
    }
1124
    }

Return to bug 53228