Example #1
0
void
dia_font_set_slant(DiaFont* font, DiaFontSlant slant)
{
  DiaFontSlant old_slant = DIA_FONT_STYLE_GET_SLANT(dia_font_get_style(font));
  g_return_if_fail(font != NULL);
  dia_pfd_set_slant(font->pfd,slant);
  if (slant != old_slant)
    _dia_font_adjust_size (font, font->height, TRUE);
}
Example #2
0
void
dia_font_set_weight(DiaFont* font, DiaFontWeight weight)
{
  DiaFontWeight old_weight = DIA_FONT_STYLE_GET_WEIGHT(dia_font_get_style(font));
  g_return_if_fail(font != NULL);
  dia_pfd_set_weight(font->pfd,weight);
  if (old_weight != weight)
    _dia_font_adjust_size (font, font->height, TRUE);
}
Example #3
0
DiaFont*
dia_font_new(const char *family, DiaFontStyle style, real height)
{
  DiaFont* font = dia_font_new_from_style(style, height);
  gboolean changed;

  changed = family != NULL && strcmp (pango_font_description_get_family(font->pfd), family) != 0;
  pango_font_description_set_family(font->pfd, family);

  if (changed)
    _dia_font_adjust_size (font, font->height, TRUE);

  return font;
}
Example #4
0
void
dia_font_set_any_family(DiaFont* font, const char* family)
{
  gboolean changed;

  g_return_if_fail(font != NULL);

  changed = strcmp (pango_font_description_get_family(font->pfd), family) != 0;
  pango_font_description_set_family(font->pfd, family);
  if (changed) /* force recalculation on name change */
    _dia_font_adjust_size (font, font->height, TRUE);
  if (font->legacy_name) {
    g_free(font->legacy_name);
    font->legacy_name = NULL;
  }
}
Example #5
0
File: font.c Project: rennhak/Dia
DiaFont*
dia_font_new_from_style(DiaFontStyle style, real height)
{
  DiaFont* retval;
  /* in the future we could establish Dia's own default font
   * matching to be as (font-)system independent as possible.
   * For now fall back to Pangos configuration --hb
   */
  PangoFontDescription* pfd = pango_font_description_new();
  dia_pfd_set_family(pfd,DIA_FONT_STYLE_GET_FAMILY(style));
  dia_pfd_set_weight(pfd,DIA_FONT_STYLE_GET_WEIGHT(style));
  dia_pfd_set_slant(pfd,DIA_FONT_STYLE_GET_SLANT(style));
  dia_pfd_set_height(pfd,height);
  
  retval = DIA_FONT(g_object_new(DIA_TYPE_FONT, NULL));
  retval->pfd = pfd;
  _dia_font_adjust_size (retval, height, FALSE);
  retval->legacy_name = NULL;
  return retval;
}
Example #6
0
void
dia_font_set_height(DiaFont* font, real height)
{
  _dia_font_adjust_size (font, height, FALSE);
}