Пример #1
0
static void
gst_time_overlay_init (GstTimeOverlay * overlay, GstTimeOverlayClass * klass)
{
  PangoFontDescription *font_description;
  GstTextOverlay *textoverlay;
  PangoContext *context;

  textoverlay = GST_TEXT_OVERLAY (overlay);

  context = GST_TEXT_OVERLAY_CLASS (klass)->pango_context;

  pango_context_set_language (context, pango_language_from_string ("en_US"));
  pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);

  font_description = pango_font_description_new ();
  pango_font_description_set_family_static (font_description, "Monospace");
  pango_font_description_set_style (font_description, PANGO_STYLE_NORMAL);
  pango_font_description_set_variant (font_description, PANGO_VARIANT_NORMAL);
  pango_font_description_set_weight (font_description, PANGO_WEIGHT_NORMAL);
  pango_font_description_set_stretch (font_description, PANGO_STRETCH_NORMAL);
  pango_font_description_set_size (font_description, 18 * PANGO_SCALE);
  pango_context_set_font_description (context, font_description);
  pango_font_description_free (font_description);

  textoverlay->valign = GST_TEXT_OVERLAY_VALIGN_TOP;
  textoverlay->halign = GST_TEXT_OVERLAY_HALIGN_LEFT;
}
Пример #2
0
JNIEXPORT void JNICALL
Java_org_gnome_pango_PangoFontDescription_pango_1font_1description_1set_1stretch
(
	JNIEnv* env,
	jclass cls,
	jlong _self,
	jint _stretch
)
{
	PangoFontDescription* self;
	PangoStretch stretch;

	// convert parameter self
	self = (PangoFontDescription*) _self;

	// convert parameter stretch
	stretch = (PangoStretch) _stretch;

	// call function
	pango_font_description_set_stretch(self, stretch);

	// cleanup parameter self

	// cleanup parameter stretch
}
Пример #3
0
static void
gst_time_overlay_class_init (GstTimeOverlayClass * klass)
{
  GstTextOverlayClass *gsttextoverlay_class;
  PangoContext *context;
  PangoFontDescription *font_description;

  gsttextoverlay_class = (GstTextOverlayClass *) klass;

  gsttextoverlay_class->get_text = gst_time_overlay_get_text;

  g_mutex_lock (GST_TEXT_OVERLAY_CLASS (klass)->pango_lock);
  context = GST_TEXT_OVERLAY_CLASS (klass)->pango_context;

  pango_context_set_language (context, pango_language_from_string ("en_US"));
  pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);

  font_description = pango_font_description_new ();
  pango_font_description_set_family_static (font_description, "Monospace");
  pango_font_description_set_style (font_description, PANGO_STYLE_NORMAL);
  pango_font_description_set_variant (font_description, PANGO_VARIANT_NORMAL);
  pango_font_description_set_weight (font_description, PANGO_WEIGHT_NORMAL);
  pango_font_description_set_stretch (font_description, PANGO_STRETCH_NORMAL);
  pango_font_description_set_size (font_description, 18 * PANGO_SCALE);
  pango_context_set_font_description (context, font_description);
  pango_font_description_free (font_description);
  g_mutex_unlock (GST_TEXT_OVERLAY_CLASS (klass)->pango_lock);
}
Пример #4
0
font_instance *font_factory::Face(char const *family, int variant, int style, int weight, int stretch, int /*size*/, int /*spacing*/)
{
    PangoFontDescription *temp_descr = pango_font_description_new();
    pango_font_description_set_family(temp_descr,family);
    pango_font_description_set_weight(temp_descr,(PangoWeight)weight);
    pango_font_description_set_stretch(temp_descr,(PangoStretch)stretch);
    pango_font_description_set_style(temp_descr,(PangoStyle)style);
    pango_font_description_set_variant(temp_descr,(PangoVariant)variant);
    font_instance *res = Face(temp_descr);
    pango_font_description_free(temp_descr);
    return res;
}
Пример #5
0
static void
gst_imx_g2d_time_overlay_class_init (GstImxG2DTimeOverlayClass * klass)
{
  GstElementClass *gstelement_class;
  GstImxG2DBaseTextOverlayClass *gsttextoverlay_class;
  GObjectClass *gobject_class;
  PangoContext *context;
  PangoFontDescription *font_description;

  gsttextoverlay_class = (GstImxG2DBaseTextOverlayClass *) klass;
  gstelement_class = (GstElementClass *) klass;
  gobject_class = (GObjectClass *) klass;

  gst_element_class_set_static_metadata (gstelement_class, "Time overlay",
      "Filter/Editor/Video",
      "Overlays buffer time stamps on a video stream",
      "Tim-Philipp Müller <*****@*****.**>");

  gsttextoverlay_class->get_text = gst_imx_g2d_time_overlay_get_text;

  gobject_class->set_property = gst_imx_g2d_time_overlay_set_property;
  gobject_class->get_property = gst_imx_g2d_time_overlay_get_property;

  g_object_class_install_property (gobject_class, PROP_TIME_LINE,
      g_param_spec_enum ("time-mode", "Time Mode", "What time to show",
          GST_TYPE_IMX_G2D_TIME_OVERLAY_TIME_LINE, DEFAULT_TIME_LINE,
          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  g_object_class_install_property (gobject_class, PROP_TIMEALIGNMENT,
      g_param_spec_enum ("time-alignment", "Time alignment",
          "Time alignment of the text", GST_TYPE_IMX_G2D_TIME_OVERLAY_TIMEALIGN,
          DEFAULT_PROP_TIMEALIGNMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  g_mutex_lock (gsttextoverlay_class->pango_lock);
  context = gsttextoverlay_class->pango_context;

  pango_context_set_language (context, pango_language_from_string ("en_US"));
  pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);

  font_description = pango_font_description_new ();
  pango_font_description_set_family_static (font_description, "Monospace");
  pango_font_description_set_style (font_description, PANGO_STYLE_NORMAL);
  pango_font_description_set_variant (font_description, PANGO_VARIANT_NORMAL);
  pango_font_description_set_weight (font_description, PANGO_WEIGHT_NORMAL);
  pango_font_description_set_stretch (font_description, PANGO_STRETCH_NORMAL);
  pango_font_description_set_size (font_description, 18 * PANGO_SCALE);
  pango_context_set_font_description (context, font_description);
  pango_font_description_free (font_description);
  g_mutex_unlock (gsttextoverlay_class->pango_lock);
}
static void
gst_clock_overlay_class_init (GstClockOverlayClass * klass)
{
  GObjectClass *gobject_class;
  GstElementClass *gstelement_class;
  GstBaseTextOverlayClass *gsttextoverlay_class;
  PangoContext *context;
  PangoFontDescription *font_description;

  gobject_class = (GObjectClass *) klass;
  gstelement_class = (GstElementClass *) klass;
  gsttextoverlay_class = (GstBaseTextOverlayClass *) klass;

  gobject_class->finalize = gst_clock_overlay_finalize;
  gobject_class->set_property = gst_clock_overlay_set_property;
  gobject_class->get_property = gst_clock_overlay_get_property;

  gst_element_class_set_static_metadata (gstelement_class, "Clock overlay",
      "Filter/Editor/Video",
      "Overlays the current clock time on a video stream",
      "Tim-Philipp Müller <*****@*****.**>");

  gsttextoverlay_class->get_text = gst_clock_overlay_get_text;

  g_object_class_install_property (gobject_class, PROP_TIMEFORMAT,
      g_param_spec_string ("time-format", "Date/Time Format",
          "Format to use for time and date value, as in strftime.",
          DEFAULT_PROP_TIMEFORMAT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  g_mutex_lock (gsttextoverlay_class->pango_lock);
  context = gsttextoverlay_class->pango_context;

  pango_context_set_language (context, pango_language_from_string ("en_US"));
  pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);

  font_description = pango_font_description_new ();
  pango_font_description_set_family_static (font_description, "Monospace");
  pango_font_description_set_style (font_description, PANGO_STYLE_NORMAL);
  pango_font_description_set_variant (font_description, PANGO_VARIANT_NORMAL);
  pango_font_description_set_weight (font_description, PANGO_WEIGHT_NORMAL);
  pango_font_description_set_stretch (font_description, PANGO_STRETCH_NORMAL);
  pango_font_description_set_size (font_description, 18 * PANGO_SCALE);
  pango_context_set_font_description (context, font_description);
  pango_font_description_free (font_description);
  g_mutex_unlock (gsttextoverlay_class->pango_lock);
}
Пример #7
0
void
set_style (GtkWidget *entry, gpointer data)
{
  char *str = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
  PangoFontDescription *tmp_desc;
  
  tmp_desc = pango_font_description_from_string (str);

  pango_font_description_set_style(font_description, pango_font_description_get_style(tmp_desc));
  pango_font_description_set_variant(font_description, pango_font_description_get_variant(tmp_desc));
  pango_font_description_set_weight(font_description, pango_font_description_get_weight(tmp_desc));
  pango_font_description_set_stretch(font_description, pango_font_description_get_stretch(tmp_desc));

  pango_font_description_free (tmp_desc);
  g_free (str);
  
  reload_font ();
}
Пример #8
0
PangoFontDescription *Layout::InputStreamTextSource::styleGetFontDescription() const
{
    if (style->text == NULL) return NULL;
    PangoFontDescription *descr = pango_font_description_new();
    // Pango can't cope with spaces before or after the commas - let's remove them.
    // this code is not exactly unicode-safe, but it's similar to what's done in
    // pango, so it's not the limiting factor
    Glib::ustring family;
    if (style->text->font_family.value == NULL) {
        family = "Sans";
    } else {
        gchar **families = g_strsplit(style->text->font_family.value, ",", -1);
        if (families) {
            for (gchar **f = families ; *f ; ++f) {
                g_strstrip(*f);
                if (!family.empty()) family += ',';
                family += *f;
            }
        }
        g_strfreev(families);
    }

    pango_font_description_set_family(descr,family.c_str());
    pango_font_description_set_weight(descr,(PangoWeight)_enum_converter(style->font_weight.computed,  enum_convert_spstyle_weight_to_pango_weight,   sizeof(enum_convert_spstyle_weight_to_pango_weight)/sizeof(enum_convert_spstyle_weight_to_pango_weight[0])));
    pango_font_description_set_style(descr,(PangoStyle)_enum_converter(style->font_style.computed,   enum_convert_spstyle_style_to_pango_style,     sizeof(enum_convert_spstyle_style_to_pango_style)/sizeof(enum_convert_spstyle_style_to_pango_style[0])));
    pango_font_description_set_variant(descr,(PangoVariant)_enum_converter(style->font_variant.computed, enum_convert_spstyle_variant_to_pango_variant, sizeof(enum_convert_spstyle_variant_to_pango_variant)/sizeof(enum_convert_spstyle_variant_to_pango_variant[0])));
#ifdef USE_PANGO_WIN32
    // damn Pango fudges the size, so we need to unfudge. See source of pango_win32_font_map_init()
    pango_font_description_set_size(descr, (int) ((font_factory::Default())->fontSize*PANGO_SCALE*72/GetDeviceCaps(pango_win32_get_dc(),LOGPIXELSY))); // mandatory huge size (hinting workaround)
    // we don't set stretch on Win32, because pango-win32 has no concept of it
    // (Windows doesn't really provide any useful field it could use).
    // If we did set stretch, then any text with a font-stretch attribute would
    // end up falling back to Arial.
#else
    pango_font_description_set_size(descr, (int) ((font_factory::Default())->fontSize*PANGO_SCALE)); // mandatory huge size (hinting workaround)
    pango_font_description_set_stretch(descr,(PangoStretch)_enum_converter(style->font_stretch.computed, enum_convert_spstyle_stretch_to_pango_stretch, sizeof(enum_convert_spstyle_stretch_to_pango_stretch)/sizeof(enum_convert_spstyle_stretch_to_pango_stretch[0])));
#endif
    return descr;
}
Пример #9
0
GTKFont *GLBase::SetupGLFont(const char *FontName, int Size, int Start, int Num)
{
	PangoFontDescription *PFD;
	GTKFont *Font = new GTKFont();
	PangoFont *PF;

	PFD = pango_font_description_new();
	pango_font_description_set_family(PFD, FontName);
#ifdef _WINDOWS
	pango_font_description_set_size(PFD, (Size - 2) * PANGO_SCALE);
#else
	pango_font_description_set_size(PFD, Size * PANGO_SCALE);
#endif
	pango_font_description_set_weight(PFD, PANGO_WEIGHT_NORMAL);
	pango_font_description_set_variant(PFD, PANGO_VARIANT_NORMAL);
	pango_font_description_set_style(PFD, PANGO_STYLE_NORMAL);
	pango_font_description_set_stretch(PFD, PANGO_STRETCH_NORMAL);

	glBegin();

	Font->DisplayBase = glGenLists(Num);
	PF = gdk_gl_font_use_pango_font(PFD, Start, Num, Font->DisplayBase);
	if (PF == NULL)
	{
		printf("Cannot get a font from Pango with name and size %s %dpt, exiting.....\n\n", FontName, Size);
		exit(1);
	}
	Font->Font = PF;
	Font->NumEntries = Num;
	Font->FontSize = Size;
	Fonts.push_back(Font);
	Font->Parent = this;

	glEnd();

	pango_font_description_free(PFD);

	return Font;
}
Пример #10
0
static void
gst_clock_overlay_class_init (GstClockOverlayClass * klass)
{
  GObjectClass *gobject_class;
  GstTextOverlayClass *gsttextoverlay_class;
  PangoContext *context;
  PangoFontDescription *font_description;

  gobject_class = (GObjectClass *) klass;
  gsttextoverlay_class = (GstTextOverlayClass *) klass;

  gobject_class->finalize = gst_clock_overlay_finalize;
  gobject_class->set_property = gst_clock_overlay_set_property;
  gobject_class->get_property = gst_clock_overlay_get_property;

  gsttextoverlay_class->get_text = gst_clock_overlay_get_text;

  g_object_class_install_property (gobject_class, PROP_TIMEFORMAT,
      g_param_spec_string ("time-format", "Date/Time Format",
          "Format to use for time and date value, as in strftime.",
          DEFAULT_PROP_TIMEFORMAT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  g_mutex_lock (GST_TEXT_OVERLAY_CLASS (klass)->pango_lock);
  context = GST_TEXT_OVERLAY_CLASS (klass)->pango_context;

  pango_context_set_language (context, pango_language_from_string ("en_US"));
  pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);

  font_description = pango_font_description_new ();
  pango_font_description_set_family_static (font_description, "Monospace");
  pango_font_description_set_style (font_description, PANGO_STYLE_NORMAL);
  pango_font_description_set_variant (font_description, PANGO_VARIANT_NORMAL);
  pango_font_description_set_weight (font_description, PANGO_WEIGHT_NORMAL);
  pango_font_description_set_stretch (font_description, PANGO_STRETCH_NORMAL);
  pango_font_description_set_size (font_description, 18 * PANGO_SCALE);
  pango_context_set_font_description (context, font_description);
  pango_font_description_free (font_description);
  g_mutex_unlock (GST_TEXT_OVERLAY_CLASS (klass)->pango_lock);
}
Пример #11
0
/* This is copied straight from make_alias_description in pango, plus
 * the gimp_font_list_add_font bits.
 */
static void
gimp_font_list_make_alias (GimpFontList *list,
                           PangoContext *context,
                           const gchar  *family,
                           gboolean      bold,
                           gboolean      italic)
{
  PangoFontDescription *desc = pango_font_description_new ();

  pango_font_description_set_family (desc, family);
  pango_font_description_set_style (desc,
                                    italic ?
                                    PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL);
  pango_font_description_set_variant (desc, PANGO_VARIANT_NORMAL);
  pango_font_description_set_weight (desc,
                                     bold ?
                                     PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL);
  pango_font_description_set_stretch (desc, PANGO_STRETCH_NORMAL);

  gimp_font_list_add_font (list, context, desc);

  pango_font_description_free (desc);
}
Пример #12
0
static PangoLayout *
rsvg_text_create_layout (RsvgDrawingCtx * ctx,
                         RsvgState * state, const char *text, PangoContext * context)
{
    PangoFontDescription *font_desc;
    PangoLayout *layout;
    PangoAttrList *attr_list;
    PangoAttribute *attribute;

    if (state->lang)
        pango_context_set_language (context, pango_language_from_string (state->lang));

    if (state->unicode_bidi == UNICODE_BIDI_OVERRIDE || state->unicode_bidi == UNICODE_BIDI_EMBED)
        pango_context_set_base_dir (context, state->text_dir);

    font_desc = pango_font_description_copy (pango_context_get_font_description (context));

    if (state->font_family)
        pango_font_description_set_family_static (font_desc, state->font_family);

    pango_font_description_set_style (font_desc, state->font_style);
    pango_font_description_set_variant (font_desc, state->font_variant);
    pango_font_description_set_weight (font_desc, state->font_weight);
    pango_font_description_set_stretch (font_desc, state->font_stretch);
    pango_font_description_set_size (font_desc,
                                     _rsvg_css_normalize_font_size (state, ctx) *
                                     PANGO_SCALE / ctx->dpi_y * 72);

    layout = pango_layout_new (context);
    pango_layout_set_font_description (layout, font_desc);
    pango_font_description_free (font_desc);

    attr_list = pango_attr_list_new ();
    attribute = pango_attr_letter_spacing_new (_rsvg_css_normalize_length (&state->letter_spacing,
                                                                           ctx, 'h') * PANGO_SCALE);
    attribute->start_index = 0;
    attribute->end_index = G_MAXINT;
    pango_attr_list_insert (attr_list, attribute); 

    if (state->has_font_decor && text) {
        if (state->font_decor & TEXT_UNDERLINE) {
            attribute = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE);
            attribute->start_index = 0;
            attribute->end_index = -1;
            pango_attr_list_insert (attr_list, attribute);
        }
	if (state->font_decor & TEXT_STRIKE) {
            attribute = pango_attr_strikethrough_new (TRUE);
            attribute->start_index = 0;
            attribute->end_index = -1;
            pango_attr_list_insert (attr_list, attribute);
	}
    }

    pango_layout_set_attributes (layout, attr_list);
    pango_attr_list_unref (attr_list);

    if (text)
        pango_layout_set_text (layout, text, -1);
    else
        pango_layout_set_text (layout, NULL, 0);

    pango_layout_set_alignment (layout, (state->text_dir == PANGO_DIRECTION_LTR ||
                                         state->text_dir == PANGO_DIRECTION_TTB_LTR) ?
                                PANGO_ALIGN_LEFT : PANGO_ALIGN_RIGHT);

    return layout;
}
Пример #13
0
void Font::setStretch(FontStretch stretch)
{
	PangoStretch s = static_cast<PangoStretch>(stretch);
	pango_font_description_set_stretch(desc_, s);
}
static void pf_setStretch(JNIEnv*, jclass, jlong obj, jint stretch) {
    if (!obj) return;
    PangoFontDescription* desc = reinterpret_cast<PangoFontDescription*>(obj);
    pango_font_description_set_stretch(desc, (PangoStretch) stretch);
}
Пример #15
0
unsigned Gosu::pango::textWidth(const std::wstring& text,
    const std::wstring& fontFace, unsigned fontHeight,
    unsigned fontFlags)
{
    g_type_init();

    int dpi_x = 100, dpi_y = 100;

    context = pango_ft2_get_context(dpi_x, dpi_y);

    pango_context_set_language(context, pango_language_from_string ("en_US"));
    PangoDirection init_dir = PANGO_DIRECTION_LTR;
    pango_context_set_base_dir(context, init_dir);

//    static PangoFontDescription *font_description;
    font_description = pango_font_description_new();

    pango_font_description_set_family(font_description,
        g_strdup(narrow(fontFace).c_str()));
    pango_font_description_set_style(font_description,
        (fontFlags & ffItalic) ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL);
    pango_font_description_set_variant(font_description, PANGO_VARIANT_NORMAL);
    pango_font_description_set_weight(font_description,
        (fontFlags & ffBold) ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL);
    pango_font_description_set_stretch(font_description, PANGO_STRETCH_NORMAL);
    int init_scale = int(fontHeight/2.0 + 0.5);
    pango_font_description_set_size(font_description, init_scale * PANGO_SCALE);

    pango_context_set_font_description(context, font_description);


    layout = pango_layout_new(context);


    if(fontFlags & ffUnderline)
    {
//        PangoAttribute *attr;
        attr = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
        attr->start_index = 0;
        attr->end_index = text.length();
//        PangoAttrList* attrList;
        attrList = pango_attr_list_new();
        pango_attr_list_insert(attrList, attr);
        pango_layout_set_attributes(layout, attrList);
        pango_attr_list_unref(attrList);
    }


    // IMPR: Catch errors? (Last NULL-Pointer)
    gchar* utf8Str = g_ucs4_to_utf8((gunichar*)text.c_str(), text.length(), NULL, NULL, NULL);
    pango_layout_set_text(layout, utf8Str, -1);
    g_free(utf8Str);

    PangoDirection base_dir = pango_context_get_base_dir(context);
    pango_layout_set_alignment(layout,
        base_dir == PANGO_DIRECTION_LTR ? PANGO_ALIGN_LEFT : PANGO_ALIGN_RIGHT);

    pango_layout_set_width(layout, -1);

    PangoRectangle logical_rect;

    pango_layout_get_pixel_extents(layout, NULL, &logical_rect);
    height = logical_rect.height;
    width = logical_rect.width;

    return width;
}
Пример #16
0
font_instance *font_factory::Face(char const *family, NRTypePosDef apos)
{
    PangoFontDescription *temp_descr = pango_font_description_new();

    pango_font_description_set_family(temp_descr, family);

    if ( apos.variant == NR_POS_VARIANT_SMALLCAPS ) {
        pango_font_description_set_variant(temp_descr, PANGO_VARIANT_SMALL_CAPS);
    } else {
        pango_font_description_set_variant(temp_descr, PANGO_VARIANT_NORMAL);
    }

    if ( apos.italic ) {
        pango_font_description_set_style(temp_descr, PANGO_STYLE_ITALIC);
    } else if ( apos.oblique ) {
        pango_font_description_set_style(temp_descr, PANGO_STYLE_OBLIQUE);
    } else {
        pango_font_description_set_style(temp_descr, PANGO_STYLE_NORMAL);
    }

    if ( apos.weight <= NR_POS_WEIGHT_THIN ) {
        pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_THIN);
    } else if ( apos.weight <= NR_POS_WEIGHT_ULTRA_LIGHT ) {
        pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_ULTRALIGHT);
    } else if ( apos.weight <= NR_POS_WEIGHT_LIGHT ) {
        pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_LIGHT);
    } else if ( apos.weight <= NR_POS_WEIGHT_BOOK ) {
        pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_BOOK);
    } else if ( apos.weight <= NR_POS_WEIGHT_NORMAL ) {
        pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_NORMAL);
    } else if ( apos.weight <= NR_POS_WEIGHT_MEDIUM ) {
        pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_MEDIUM);
    } else if ( apos.weight <= NR_POS_WEIGHT_SEMIBOLD ) {
        pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_SEMIBOLD);
    } else if ( apos.weight <= NR_POS_WEIGHT_BOLD ) {
        pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_BOLD);
    } else if ( apos.weight <= NR_POS_WEIGHT_ULTRA_BOLD ) {
        pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_ULTRABOLD);
    } else {
        pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_HEAVY);
    }
    // PANGO_WIEGHT_ULTRAHEAVY not used (not CSS2)

    if ( apos.stretch <= NR_POS_STRETCH_ULTRA_CONDENSED ) {
        pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_EXTRA_CONDENSED);
    } else if ( apos.stretch <= NR_POS_STRETCH_CONDENSED ) {
        pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_CONDENSED);
    } else if ( apos.stretch <= NR_POS_STRETCH_SEMI_CONDENSED ) {
        pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_SEMI_CONDENSED);
    } else if ( apos.stretch <= NR_POS_STRETCH_NORMAL ) {
        pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_NORMAL);
    } else if ( apos.stretch <= NR_POS_STRETCH_SEMI_EXPANDED ) {
        pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_SEMI_EXPANDED);
    } else if ( apos.stretch <= NR_POS_STRETCH_EXPANDED ) {
        pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_EXPANDED);
    } else {
        pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_EXTRA_EXPANDED);
    }

    font_instance *res = Face(temp_descr);
    pango_font_description_free(temp_descr);
    return res;
}