当前位置: 首页>>代码示例>>C++>>正文


C++ pango_font_description_set_family函数代码示例

本文整理汇总了C++中pango_font_description_set_family函数的典型用法代码示例。如果您正苦于以下问题:C++ pango_font_description_set_family函数的具体用法?C++ pango_font_description_set_family怎么用?C++ pango_font_description_set_family使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pango_font_description_set_family函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pangox_layout_set_font_face

void pangox_layout_set_font_face(PangoLayout *layout, OutputFontFace face)
{
    if (layout != NULL) {
        const PangoFontDescription *old_font;
        PangoFontDescription *new_font;

        if ((old_font = pango_layout_get_font_description(layout)) == NULL) {
            PangoContext *context = pango_layout_get_context(layout);
            new_font = pango_font_description_copy(pango_context_get_font_description(context));
        }
        else {
            new_font = pango_font_description_copy(old_font);
        }
        switch (face) {
            case PS_FONT_SANS: {
                pango_font_description_set_family(new_font, "Sans");
                break;
            }
            case PS_FONT_SERIF: {
                pango_font_description_set_family(new_font, "Serif");
                break;
            }
            default: {
                pango_font_description_set_family(new_font, "Fixed");
                break;
            }
	}
        pango_layout_set_font_description(layout, new_font);
        pango_font_description_free(new_font);
    }
}
开发者ID:nicksexton,项目名称:gui-tools,代码行数:31,代码来源:lib_cairox.c

示例2: pf_setFamily

static void pf_setFamily(JNIEnv* env, jclass, jlong obj, jstring family) {
    if (!obj) return;
    PangoFontDescription* desc = reinterpret_cast<PangoFontDescription*>(obj);
    if (!family) {
        pango_font_description_set_family(desc, "");
        return;
    }
    const char* cfamily = env->GetStringUTFChars(family, nullptr);
    pango_font_description_set_family(desc, cfamily);
    env->ReleaseStringUTFChars(family, cfamily);
}
开发者ID:iamralpht,项目名称:letterplex,代码行数:11,代码来源:JNIPangoFontDescription.cpp

示例3: pango_font_description_new

void wxFontRefData::Init(int pointSize,
                         wxFontFamily family,
                         wxFontStyle style,
                         wxFontWeight weight,
                         bool underlined,
                         const wxString& faceName,
                         wxFontEncoding encoding)
{
    m_family = family == wxFONTFAMILY_DEFAULT ? wxFONTFAMILY_SWISS : family;

    m_underlined = underlined;
    m_encoding = encoding;
    if ( m_encoding == wxFONTENCODING_DEFAULT )
        m_encoding = wxFont::GetDefaultEncoding();

    m_noAA = false;

    // Create native font info
    m_nativeFontInfo.description = pango_font_description_new();

    // And set its values
    if (!faceName.empty())
    {
       pango_font_description_set_family( m_nativeFontInfo.description,
                                           wxGTK_CONV_SYS(faceName) );
    }
    else
    {
        switch (m_family)
        {
            case wxFONTFAMILY_MODERN:
            case wxFONTFAMILY_TELETYPE:
               pango_font_description_set_family( m_nativeFontInfo.description, "monospace" );
               break;
            case wxFONTFAMILY_ROMAN:
               pango_font_description_set_family( m_nativeFontInfo.description, "serif" );
               break;
            case wxFONTFAMILY_SWISS:
               // SWISS = sans serif
            default:
               pango_font_description_set_family( m_nativeFontInfo.description, "sans" );
               break;
        }
    }

    SetStyle( style == wxDEFAULT ? wxFONTSTYLE_NORMAL : style );
    SetPointSize( (pointSize == wxDEFAULT || pointSize == -1)
                    ? wxDEFAULT_FONT_SIZE
                    : pointSize );
    SetWeight( weight == wxDEFAULT ? wxFONTWEIGHT_NORMAL : weight );
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:51,代码来源:font.cpp

示例4: gw_settingswindow_sync_global_document_font_cb

G_MODULE_EXPORT void 
gw_settingswindow_sync_global_document_font_cb (GSettings *settings, gchar *KEY, gpointer data)
{
    //Declarations
    GwSettingsWindow *window;
    GwSettingsWindowPrivate *priv;
    GwApplication *application;
    LwPreferences *preferences;
    gchar font[50];
    gchar *font2;
    gchar *text;
    PangoFontDescription *desc;

    //Initializations
    window = GW_SETTINGSWINDOW (data);
    g_return_if_fail (window != NULL);
    priv = window->priv;
    application = gw_window_get_application (GW_WINDOW (window));
    preferences = gw_application_get_preferences (application);
    lw_preferences_get_string_by_schema (preferences, font, LW_SCHEMA_GNOME_INTERFACE, LW_KEY_DOCUMENT_FONT_NAME, 50);
    desc = pango_font_description_from_string (font);
    pango_font_description_set_family (desc, "Serif");
    font2 = pango_font_description_to_string (desc);
    if (font2) text = g_strdup_printf (gettext("_Use the System Document Font (%s)"), font2);
    g_free (font2); font2 = NULL;
    pango_font_description_free (desc); desc = NULL;

    if (text != NULL) 
    {
      gtk_button_set_label (GTK_BUTTON (priv->system_font_checkbutton), text);
      g_free (text);
    }
}
开发者ID:kyoushuu,项目名称:gwaei,代码行数:33,代码来源:settingswindow-callbacks.c

示例5: pango_load

static bool
pango_load (Lisp_Font *f)
{
    PangoLanguage *language;
    PangoFontDescription *fontdesc;
    PangoFont *font;
    PangoFontMetrics *metrics;

    if (pango_context)
    {
	language = pango_context_get_language (pango_context);
    }
    else
    {
	char *langname, *p;

#ifdef HAVE_PANGO_XFT
	pango_context = pango_xft_get_context (dpy, screen_num);
#endif

	langname = g_strdup (setlocale (LC_CTYPE, NULL));
	p = strchr (langname, '.');
	if (p)
	    *p = 0;
	p = strchr (langname, '@');
	if (p)
	    *p = 0;
	language = pango_language_from_string (langname);
	pango_context_set_language (pango_context, language);
	g_free (langname);
    }

    fontdesc = pango_font_description_from_string (rep_STR (f->name));

    if (!pango_font_description_get_family (fontdesc))
	pango_font_description_set_family (fontdesc, "Sans");
    if (pango_font_description_get_size (fontdesc) <= 0)
	pango_font_description_set_size (fontdesc, 12 * PANGO_SCALE);

    pango_context_set_font_description (pango_context, fontdesc);
    font = pango_context_load_font (pango_context, fontdesc);

    if (!font) {
        pango_font_description_free(fontdesc);
	return FALSE;
    }

    metrics = pango_font_get_metrics (font, language);

    f->ascent = metrics->ascent / PANGO_SCALE;
    f->descent = metrics->descent / PANGO_SCALE;

    pango_font_metrics_unref (metrics);

    f->font = fontdesc; /* We save the font description, not the font itself!
                        That's because it seems we can't recover it perfectly
                        later, and the layout routines want a description */

    return TRUE;
}
开发者ID:tkorvola,项目名称:sawfish,代码行数:60,代码来源:fonts.c

示例6: SetUpStatusBarStuff

void SetUpStatusBarStuff (GtkWidget* aWindow)
{
	_String			   fName = baseDirectory & "GTKResources/striped.xpm";
	statusBarLayout			 = pango_layout_new (screenPContext);
	statusBarFontDesc		 = pango_font_description_new ();
	stripedFill				 = gdk_pixmap_create_from_xpm (GDK_DRAWABLE(aWindow->window), NULL, NULL, fName.sData);
	stripedFillGC			 = gdk_gc_new (GDK_DRAWABLE(aWindow->window));
	if (stripedFill)
	{
		gdk_gc_set_fill (stripedFillGC,GDK_TILED);
		gdk_gc_set_tile	(stripedFillGC,stripedFill);
	}
	else
	{
		printf ("Failed to load a status bar .xpm from %s\n", fName.sData);
	}
	
	gdk_gc_set_line_attributes		  (stripedFillGC, 1, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
	GdkColor saveFG = {0,0,0,0};
	gdk_gc_set_foreground			  (stripedFillGC, &saveFG);

	pango_font_description_set_family (statusBarFontDesc, statusBarFont.face.sData);
	pango_font_description_set_style  (statusBarFontDesc, (statusBarFont.style & HY_FONT_ITALIC) ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL);
	pango_font_description_set_weight (statusBarFontDesc, (statusBarFont.style & HY_FONT_BOLD) ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL);
	pango_font_description_set_size   (statusBarFontDesc, statusBarFont.size*PANGO_SCALE);
	pango_layout_set_font_description (statusBarLayout, statusBarFontDesc ); // ref ?
	pango_layout_set_width			  (statusBarLayout, -1);
	
	redButtonIcon = (GdkPixbuf*)ProcureIconResource(4000);
	yellowButtonIcon = (GdkPixbuf*)ProcureIconResource(4001);
	greenButtonIcon = (GdkPixbuf*)ProcureIconResource(4002);
	orangeButtonIcon = (GdkPixbuf*)ProcureIconResource(4003);
	
}
开发者ID:mdsmith,项目名称:OCLHYPHY,代码行数:34,代码来源:main-GTK.cpp

示例7: _pango_xft_Load

static int
_pango_xft_Load(TextState * ts, const char *name)
{
   FontCtxPangoXft    *fdc;
   PangoFontDescription *font;
   PangoFontMask       flags;

   if (!_pango_ctx)
      _pango_ctx = pango_xft_get_context(disp, Dpy.screen);
   if (!_pango_ctx)
      return -1;

   font = pango_font_description_from_string(name);
   if (!font)
      return -1;

   flags = pango_font_description_get_set_fields(font);
   if ((flags & PANGO_FONT_MASK_FAMILY) == 0)
      pango_font_description_set_family(font, "sans");
   if ((flags & PANGO_FONT_MASK_SIZE) == 0)
      pango_font_description_set_size(font, 10 * PANGO_SCALE);

   fdc = EMALLOC(FontCtxPangoXft, 1);
   if (!fdc)
      return -1;
   fdc->font = font;
   ts->fdc = fdc;
   ts->need_utf8 = 1;
   ts->type = FONT_TYPE_PANGO_XFT;
   ts->ops = &FontOps_pango;
   return 0;
}
开发者ID:burzumishi,项目名称:e16,代码行数:32,代码来源:text_pango.c

示例8: F1035_13190

/* {EV_FONT_IMP}.set_face_name */
void F1035_13190 (EIF_REFERENCE Current, EIF_REFERENCE arg1)
{
	GTCX
	EIF_REFERENCE loc1 = (EIF_REFERENCE) 0;
	EIF_POINTER tp1;
	EIF_POINTER tp2;
	EIF_REFERENCE tr1 = NULL;
	RTLD;
	
	RTLI(4);
	RTLR(0,Current);
	RTLR(1,arg1);
	RTLR(2,tr1);
	RTLR(3,loc1);
	
	RTGC;
	tr1 = F920_10294(RTCV(arg1));
	RTAR(Current, tr1);
	*(EIF_REFERENCE *)(Current + _REFACS_2_) = (EIF_REFERENCE) tr1;
	tr1 = RTOSCF(13229,F1035_13229,(Current));
	loc1 = F1049_13651(RTCV(tr1), arg1);
	tp1 = *(EIF_POINTER *)(Current+ _PTROFF_3_2_0_8_0_0_);
	tp2 = *(EIF_POINTER *)(RTCV(loc1)+ _PTROFF_0_1_0_1_0_0_);
	pango_font_description_set_family((PangoFontDescription*) tp1, (char*) tp2);
	F1035_13198(Current);
	RTLE;
}
开发者ID:yehongbing,项目名称:Eiffel-Projects,代码行数:28,代码来源:ev669.c

示例9: bindings_java_getString

JNIEXPORT void JNICALL
Java_org_gnome_pango_PangoFontDescription_pango_1font_1description_1set_1family
(
	JNIEnv* env,
	jclass cls,
	jlong _self,
	jstring _family
)
{
	PangoFontDescription* self;
	const char* family;

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

	// convert parameter family
	family = (const char*) bindings_java_getString(env, _family);
	if (family == NULL) {
		return; // Java Exception already thrown
	}

	// call function
	pango_font_description_set_family(self, family);

	// cleanup parameter self

	// cleanup parameter family
	bindings_java_releaseString(family);
}
开发者ID:cyberpython,项目名称:java-gnome,代码行数:29,代码来源:PangoFontDescription.c

示例10: UT_return_if_fail

/*!
* \todo ROB parse more attributes like font-color, background-color
*/
void 		 
AP_UnixToolbar_StyleCombo::getPangoAttrs (PD_Style *pStyle, 
										  PangoFontDescription *desc) {

	UT_return_if_fail (pStyle);
	UT_LocaleTransactor t (LC_NUMERIC, "C");

	const gchar *value = NULL;

	if (pStyle->getPropertyExpand ("font-family", value)) {
		pango_font_description_set_family (desc, value);
	}

	if (pStyle->getPropertyExpand ("font-size", value)) {
		pango_font_description_set_size (desc, (gint)(UT_convertToDimension (value, DIM_PT) * PANGO_SCALE));
	}

	if (pStyle->getPropertyExpand ("font-style", value)) {
		PangoStyle style = PANGO_STYLE_NORMAL;
		if (!strcmp (value, "italic"))
			style = PANGO_STYLE_ITALIC;
		pango_font_description_set_style (desc, style);
	}

	if (pStyle->getPropertyExpand ("font-weight", value)) {
		PangoWeight weight = PANGO_WEIGHT_NORMAL;
		if (!strcmp (value, "bold"))
			weight = PANGO_WEIGHT_BOLD;
		pango_font_description_set_weight (desc, weight);
	}
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:34,代码来源:ap_UnixToolbar_StyleCombo.cpp

示例11: WXUNUSED

void wxFontRefData::Init(int pointSize,
                         wxFontFamily family,
                         wxFontStyle style,
                         wxFontWeight weight,
                         bool underlined,
                         bool strikethrough,
                         const wxString& faceName,
                         wxFontEncoding WXUNUSED(encoding))
{
    if (family == wxFONTFAMILY_DEFAULT)
        family = wxFONTFAMILY_SWISS;

    m_underlined = underlined;
    m_strikethrough = strikethrough;

    // Create native font info
    m_nativeFontInfo.description = pango_font_description_new();

    // And set its values
    if (!faceName.empty())
    {
        pango_font_description_set_family( m_nativeFontInfo.description,
                                           wxGTK_CONV_SYS(faceName) );
    }
    else
    {
        SetFamily(family);
    }

    SetStyle( style == wxDEFAULT ? wxFONTSTYLE_NORMAL : style );
    SetPointSize( (pointSize == wxDEFAULT || pointSize == -1)
                    ? wxDEFAULT_FONT_SIZE
                    : pointSize );
    SetWeight( weight == wxDEFAULT ? wxFONTWEIGHT_NORMAL : weight );
}
开发者ID:Annovae,项目名称:Dolphin-Core,代码行数:35,代码来源:font.cpp

示例12: _compose_get_font

/* compose_get_font */
static char const * _compose_get_font(Compose * compose)
{
	char const * p;
	char * q;
	GtkSettings * settings;
	PangoFontDescription * desc;

	if((p = config_get(compose->config, NULL, "messages_font")) != NULL)
		return p;
	settings = gtk_settings_get_default();
	g_object_get(G_OBJECT(settings), "gtk-font-name", &q, NULL);
	if(q != NULL)
	{
		desc = pango_font_description_from_string(q);
		g_free(q);
		pango_font_description_set_family(desc, "monospace");
		q = pango_font_description_to_string(desc);
		config_set(compose->config, NULL, "messages_font", q);
		g_free(q);
		pango_font_description_free(desc);
		if((p = config_get(compose->config, NULL, "messages_font"))
				!= NULL)
			return p;
	}
	return MAILER_MESSAGES_FONT;
}
开发者ID:khorben,项目名称:DeforaOS,代码行数:27,代码来源:compose.c

示例13: get_pango_font_description_from_info

static PangoFontDescription *
get_pango_font_description_from_info (gchar *font_family, gchar *font_weight, gint font_size)
{
	PangoFontDescription *description = NULL;
	PangoWeight pw = PANGO_WEIGHT_NORMAL;

	g_assert(font_family);
	g_assert(font_weight);
	g_assert(font_size > 0);

	description = pango_font_description_new();
	pango_font_description_set_family(description, font_family);

	if (!g_strcmp0(font_weight, "bold")) {
		pw = PANGO_WEIGHT_BOLD;
	} else {
		pw = PANGO_WEIGHT_NORMAL;
	}

	pango_font_description_set_weight(description, pw);

	pango_font_description_set_size(description,
					font_size * PANGO_SCALE);

	return description;
}
开发者ID:stringtang,项目名称:pad-keyboard,代码行数:26,代码来源:gtk-misc-utility.c

示例14: main

int main(int argc, char **argv)
{
  GtkWidget *win;
  GtkButton *button;
  PangoFontDescription *pd;

  gtk_init(&argc, &argv);
  win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title(GTK_WINDOW(win), "Basic Animation");
  g_signal_connect(G_OBJECT(win), "delete-event", gtk_main_quit, NULL);

  label = (GtkLabel *)gtk_label_new(hello);

  // since we shift a whole character per time, it's better to use
  // a monospace font, so that the shifting seems done at the same pace
  pd = pango_font_description_new();
  pango_font_description_set_family(pd, "monospace");
  gtk_widget_modify_font(GTK_WIDGET(label), pd);

  button = (GtkButton *)gtk_button_new();
  gtk_container_add(GTK_CONTAINER(button), GTK_WIDGET(label));

  gtk_container_add(GTK_CONTAINER(win), GTK_WIDGET(button));
  g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(change_dir), NULL);

  slen = strlen(hello);

  g_timeout_add(125, scroll_it, NULL);

  gtk_widget_show_all(GTK_WIDGET(win));
  gtk_main();
  return 0;
}
开发者ID:Anatolt,项目名称:RosettaCodeData,代码行数:33,代码来源:animation.c

示例15: add_text

static void add_text(cairo_surface_t* surface, int x, int y, int size, const char* text)
{
	cairo_t* cr = cairo_create(surface);
	cairo_set_source_rgb(cr, 1., 1., 1.);

	PangoLayout* layout = pango_cairo_create_layout(cr);
	pango_layout_set_text(layout, text, -1);
	PangoFontDescription* desc = pango_font_description_new();
	pango_font_description_set_family(desc, "sans");
	pango_font_description_set_weight(desc, PANGO_WEIGHT_BOLD);
	pango_font_description_set_absolute_size(desc, size * PANGO_SCALE);
	pango_layout_set_font_description(layout, desc);
	pango_font_description_free(desc);

	int w = 0;
	int h = 0;
	pango_layout_get_pixel_size(layout, &w, &h);

	cairo_move_to(cr, (x >= 0) ? x : -(x + (double)w),
			  (y >= 0) ? y : -(y + (double)h));

	pango_cairo_show_layout(cr, layout);

	g_object_unref(layout);
	cairo_destroy(cr);
}
开发者ID:mrirecon,项目名称:view,代码行数:26,代码来源:view.c


注:本文中的pango_font_description_set_family函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。