Branch: Tag:

2003-05-05

2003-05-05 14:31:08 by Jonas Wallden <jonasw@roxen.com>

Rewrote style parsing code to handle more variations such as "Regular" and
"Bold Oblique".

Rev: server/font_handlers/freetype.pike:1.20
Rev: server/font_handlers/ttf.pike:1.15

4: Inside #if !constant(Image.FreeType.Face) and #if constant(has_Image_TTF)
  #if !constant(Image.FreeType.Face)   #if constant(has_Image_TTF)   #include <config.h> - constant cvs_version = "$Id: ttf.pike,v 1.14 2002/08/16 13:55:50 mattias Exp $"; + constant cvs_version = "$Id: ttf.pike,v 1.15 2003/05/05 14:31:08 jonasw Exp $";      constant name = "TTF fonts";   constant doc = "True Type font loader. Uses freetype to render text.";
22: Inside #if !constant(Image.FreeType.Face)
     static string translate_ttf_style( string style )   { -  switch( lower_case( (style-"-")-" " ) ) -  { -  case "normal": case "regular": return "nn"; -  case "italic": return "ni"; -  case "oblique": return "ni"; -  case "bold": return "bn"; -  case "bolditalic":case "italicbold": return "bi"; -  case "black": return "Bn"; -  case "blackitalic":case "italicblack":return "Bi"; -  case "light": return "ln"; -  case "lightitalic":case "italiclight":return "li"; +  // Check for weight. Default is "n" for normal/regular/roman. +  style = lower_case((style - "-") - " "); +  string weight = "n"; +  if (has_value(style, "bold")) +  weight = "b"; +  else if (has_value(style, "black")) +  weight = "B"; +  else if (has_value(style, "light")) +  weight = "l"; +  +  // Check for slant. Default is "n" for regular. +  string slant = "n"; +  if (has_value(style, "italic") || +  has_value(style, "oblique")) +  slant = "i"; +  +  // Combine to full style +  return weight + slant;   } -  if(search(lower_case(style), "oblique")) -  return "ni"; // for now. -  return "nn"; - } +       static void build_font_names_cache( )   {