本文整理汇总了C++中pango_font_description_to_string函数的典型用法代码示例。如果您正苦于以下问题:C++ pango_font_description_to_string函数的具体用法?C++ pango_font_description_to_string怎么用?C++ pango_font_description_to_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pango_font_description_to_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply_values
static void
apply_values (void)
{
gchar *utf;
grg_ctx_set_crypt_algo (gctx, tmp_pref_crypto);
grg_ctx_set_hash_algo (gctx, tmp_pref_hash);
grg_ctx_set_comp_algo (gctx, tmp_pref_comp);
grg_ctx_set_comp_ratio (gctx, tmp_pref_ratio);
g_free (grg_pref_file);
grg_pref_file =
g_strdup (gtk_entry_get_text (GTK_ENTRY (file_entry)));
utf = g_filename_from_utf8 (grg_pref_file, -1, NULL, NULL, NULL);
if (!g_file_test (utf, G_FILE_TEST_IS_REGULAR))
{
g_free (grg_pref_file);
grg_pref_file = NULL;
gtk_entry_set_text (GTK_ENTRY (file_entry), "");
}
g_free (utf);
set_pref_font_string (pango_font_description_to_string
(pango_context_get_font_description
(gtk_widget_get_pango_context
(gtk_bin_get_child (GTK_BIN (but_font))))));
set_editor_font (grg_prefs_editor_font);
update_saveable (GRG_SAVE_ACTIVE);
grg_save_prefs ();
}
示例2: g_assert
Glib::ustring font_factory::ConstructFontSpecification(PangoFontDescription *font)
{
Glib::ustring pangoString;
g_assert(font);
if (font) {
// Once the format for the font specification is decided, it must be
// kept.. if it is absolutely necessary to change it, the attribute
// it is written to needs to have a new version so the legacy files
// can be read.
PangoFontDescription *copy = pango_font_description_copy(font);
pango_font_description_unset_fields (copy, PANGO_FONT_MASK_SIZE);
char * copyAsString = pango_font_description_to_string(copy);
pangoString = copyAsString;
g_free(copyAsString);
copyAsString = 0;
pango_font_description_free(copy);
}
return pangoString;
}
示例3: tweet_window_style_set
static void
tweet_window_style_set (GtkWidget *widget,
GtkStyle *old_style)
{
TweetWindowPrivate *priv = TWEET_WINDOW (widget)->priv;
ClutterColor active_color = { 0, };
ClutterColor text_color = { 0, };
ClutterColor bg_color = { 0, };
gchar *font_name;
tweet_widget_get_base_color (widget, GTK_STATE_SELECTED, &active_color);
tweet_widget_get_text_color (widget, GTK_STATE_NORMAL, &text_color);
tweet_widget_get_bg_color (widget, GTK_STATE_NORMAL, &bg_color);
font_name = pango_font_description_to_string (widget->style->font_desc);
tidy_stylable_set (TIDY_STYLABLE (priv->scroll),
"active-color", &active_color,
"bg-color", &bg_color,
NULL);
tidy_stylable_set (TIDY_STYLABLE (priv->status_view),
"active-color", &active_color,
"bg-color", &bg_color,
"text-color", &text_color,
"font-name", font_name,
NULL);
g_free (font_name);
}
示例4: gimp_font_util_pango_font_description_to_string
gchar *
gimp_font_util_pango_font_description_to_string (const PangoFontDescription *desc)
{
gchar *name;
size_t wordlen;
const gchar *p;
g_return_val_if_fail (desc != NULL, NULL);
name = pango_font_description_to_string (desc);
p = getword (name, name + strlen (name), &wordlen);
if (wordlen)
{
gchar *end;
gdouble size;
size = g_ascii_strtod (p, &end);
if (end - p == wordlen)
{
gchar *new_name;
new_name = g_strconcat (name, ",", NULL);
g_free (name);
name = new_name;
}
}
return name;
}
示例5: gimp_font_list_add_font
static void
gimp_font_list_add_font (GimpFontList *list,
PangoContext *context,
PangoFontDescription *desc)
{
gchar *name;
if (! desc)
return;
name = pango_font_description_to_string (desc);
if (g_utf8_validate (name, -1, NULL))
{
GimpFont *font;
font = g_object_new (GIMP_TYPE_FONT,
"name", name,
"pango-context", context,
NULL);
gimp_container_add (GIMP_CONTAINER (list), GIMP_OBJECT (font));
g_object_unref (font);
}
g_free (name);
}
示例6: st_entry_style_changed
static void
st_entry_style_changed (StWidget *self)
{
StEntryPrivate *priv = ST_ENTRY_PRIV (self);
StThemeNode *theme_node;
ClutterColor color;
const PangoFontDescription *font;
gchar *font_string;
gdouble size;
theme_node = st_widget_get_theme_node (self);
st_theme_node_get_foreground_color (theme_node, &color);
clutter_text_set_color (CLUTTER_TEXT (priv->entry), &color);
if (st_theme_node_lookup_length (theme_node, "caret-size", TRUE, &size))
clutter_text_set_cursor_size (CLUTTER_TEXT (priv->entry), (int)(.5 + size));
if (st_theme_node_lookup_color (theme_node, "caret-color", TRUE, &color))
clutter_text_set_cursor_color (CLUTTER_TEXT (priv->entry), &color);
if (st_theme_node_lookup_color (theme_node, "selection-background-color", TRUE, &color))
clutter_text_set_selection_color (CLUTTER_TEXT (priv->entry), &color);
if (st_theme_node_lookup_color (theme_node, "selected-color", TRUE, &color))
clutter_text_set_selected_text_color (CLUTTER_TEXT (priv->entry), &color);
font = st_theme_node_get_font (theme_node);
font_string = pango_font_description_to_string (font);
clutter_text_set_font_name (CLUTTER_TEXT (priv->entry), font_string);
g_free (font_string);
ST_WIDGET_CLASS (st_entry_parent_class)->style_changed (self);
}
示例7: 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);
}
}
示例8: matekbd_indicator_config_load_font
/**
* static applet config functions
*/
static void
matekbd_indicator_config_load_font (MatekbdIndicatorConfig * ind_config)
{
ind_config->font_family =
g_settings_get_string (ind_config->settings,
MATEKBD_INDICATOR_CONFIG_KEY_FONT_FAMILY);
if (ind_config->font_family == NULL ||
ind_config->font_family[0] == '\0') {
PangoFontDescription *fd = NULL;
GtkStyle *style =
gtk_rc_get_style_by_paths (gtk_settings_get_default (),
GTK_STYLE_PATH,
GTK_STYLE_PATH,
GTK_TYPE_LABEL);
if (style != NULL)
fd = style->font_desc;
if (fd != NULL) {
ind_config->font_family =
g_strdup (pango_font_description_to_string(fd));
}
}
xkl_debug (150, "font: [%s]\n", ind_config->font_family);
}
示例9: gtk_widget_get_style
gchar *get_font_name_from_widget(GtkWidget *widget) /* MUST BE FREED */
{
GtkStyle *style;
style = gtk_widget_get_style(widget);
return pango_font_description_to_string(style->font_desc);
}
示例10: _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;
}
示例11: run_fontsel_settings_dlg
static void
run_fontsel_settings_dlg(SettingsWidget *sw) {
GtkWidget *dlg;
const gchar *newfont;
gchar *oldfont;
dlg = gtk_font_selection_dialog_new(_("Select font"));
gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(dlg),
gtk_label_get_text(GTK_LABEL(sw->widget)));
if (gtk_dialog_run(GTK_DIALOG(dlg)) == GTK_RESPONSE_OK) {
gtk_label_set_text(GTK_LABEL(sw->widget),
gtk_font_selection_dialog_get_font_name(
GTK_FONT_SELECTION_DIALOG(dlg)));
}
newfont = gtk_label_get_text(GTK_LABEL(sw->widget));
oldfont = pango_font_description_to_string(
pango_context_get_font_description(
gtk_widget_get_pango_context(GTK_WIDGET(sw->data))));
if (newfont && g_ascii_strcasecmp(oldfont, newfont) != 0) {
string_replace(sw->conf, g_strdup(newfont));
jam_widget_set_font(sw->widget, newfont);
jam_widget_set_font(sw->data, newfont);
}
g_free(oldfont);
gtk_widget_destroy(dlg);
}
示例12: pango_font_description_to_string
JNIEXPORT jstring JNICALL
Java_org_gnome_pango_PangoFontDescription_pango_1font_1description_1to_1string
(
JNIEnv* env,
jclass cls,
jlong _self
)
{
char* result;
jstring _result;
PangoFontDescription* self;
// convert parameter self
self = (PangoFontDescription*) _self;
// call function
result = pango_font_description_to_string(self);
// cleanup parameter self
// translate return value to JNI type
_result = (jstring) bindings_java_newString(env, result);
// cleanup return value
if (result != NULL) {
g_free(result);
}
// and finally
return _result;
}
示例13: pango_font_description_to_string
string PangoFontInfo::DescriptionName() const {
if (!desc_) return "";
char* desc_str = pango_font_description_to_string(desc_);
string desc_name(desc_str);
g_free(desc_str);
return desc_name;
}
示例14: Clear
bool PangoFontInfo::ParseFontDescription(const PangoFontDescription *desc) {
Clear();
const char* family = pango_font_description_get_family(desc);
if (!family) {
char* desc_str = pango_font_description_to_string(desc);
tprintf("WARNING: Could not parse family name from description: '%s'\n",
desc_str);
g_free(desc_str);
return false;
}
family_name_ = string(family);
desc_ = pango_font_description_copy(desc);
is_monospace_ = IsMonospaceFontFamily(family);
// Set font size in points
font_size_ = pango_font_description_get_size(desc);
if (!pango_font_description_get_size_is_absolute(desc)) {
font_size_ /= PANGO_SCALE;
}
PangoStyle style = pango_font_description_get_style(desc);
is_italic_ = (PANGO_STYLE_ITALIC == style ||
PANGO_STYLE_OBLIQUE == style);
is_smallcaps_ = (pango_font_description_get_variant(desc)
== PANGO_VARIANT_SMALL_CAPS);
is_bold_ = (pango_font_description_get_weight(desc) >= PANGO_WEIGHT_BOLD);
// We dont have a way to detect whether a font is of type Fraktur. The fonts
// we currently use all have "Fraktur" in their family name, so we do a
// fragile but functional check for that here.
is_fraktur_ = (strcasestr(family, "Fraktur") != NULL);
return true;
}
示例15: he_helper_get_logical_font_desc
/**
* he_helper_get_logical_font_desc:
* @name: The logical font name (see he-helper.h for possible values)
*
* Returns a newly-allocated string that contains the string representation
* of the Pango font description for the given logical string. This can be
* used in the font_desc attribute of span elements in Pango markup.
*
* This function should be used to get the font desc for Pango markup in
* special use cases (e.g. GtkTreeView, mixed-content GtkLabel). If you
* want to set a logical font directly on a widget, you can use
* #hildon_helper_set_logical_font (from Hildon 2.2) for this.
*
* The return value should be freed with g_free() after use.
**/
gchar *
he_helper_get_logical_font_desc (const gchar *name)
{
GtkSettings *settings = gtk_settings_get_default();
GtkStyle *style = gtk_rc_get_style_by_paths(settings,
name, NULL, G_TYPE_NONE);
return pango_font_description_to_string(style->font_desc);
}