* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Cambridge, MA 02139, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Modified by the GTK+ Team and others 2003. See the AUTHORS
GtkFontButtonPrivate *priv = font_button->priv;
if (priv->font_dialog)
- return gtk_font_chooser_set_show_preview_entry (GTK_FONT_CHOOSER (priv->font_dialog), show);
-
- priv->show_preview_entry = show != FALSE;
+ gtk_font_chooser_set_show_preview_entry (GTK_FONT_CHOOSER (priv->font_dialog), show);
+ else
+ priv->show_preview_entry = show != FALSE;
}
static PangoFontFamily *
{
font_button->priv->use_font = use_font;
- if (use_font)
- gtk_font_button_label_use_font (font_button);
- else
- gtk_widget_set_style (font_button->priv->font_label, NULL);
+ gtk_font_button_label_use_font (font_button);
- g_object_notify (G_OBJECT (font_button), "use-font");
+ g_object_notify (G_OBJECT (font_button), "use-font");
}
}
{
font_button->priv->use_size = use_size;
- if (font_button->priv->use_font)
- gtk_font_button_label_use_font (font_button);
+ gtk_font_button_label_use_font (font_button);
g_object_notify (G_OBJECT (font_button), "use-size");
}
{
PangoFontDescription *desc;
- if (!font_button->priv->use_font)
- return;
-
- desc = pango_font_description_copy (font_button->priv->font_desc);
+ if (font_button->priv->use_font)
+ {
+ desc = pango_font_description_copy (font_button->priv->font_desc);
- if (!font_button->priv->use_size)
- pango_font_description_unset_fields (desc, PANGO_FONT_MASK_SIZE);
+ if (!font_button->priv->use_size)
+ pango_font_description_unset_fields (desc, PANGO_FONT_MASK_SIZE);
+ }
+ else
+ desc = NULL;
- gtk_widget_modify_font (font_button->priv->font_label, desc);
+ gtk_widget_override_font (font_button->priv->font_label, desc);
- pango_font_description_free (desc);
+ if (desc)
+ pango_font_description_free (desc);
}
static void
g_assert (priv->font_desc != NULL);
- if (priv->show_style &&
- priv->font_family != NULL &&
- priv->font_face != NULL &&
- g_ascii_strcasecmp (pango_font_face_get_face_name (priv->font_face), "Regular") != 0)
+ if (priv->show_style)
{
- family_style = g_strdup_printf ("%s %s",
- pango_font_family_get_name (priv->font_family),
- pango_font_face_get_face_name (priv->font_face));
-
+ PangoFontDescription *desc = pango_font_description_copy_static (priv->font_desc);
+ pango_font_description_unset_fields (desc, PANGO_FONT_MASK_SIZE);
+ family_style = pango_font_description_to_string (desc);
+ pango_font_description_free (desc);
}
- else if (priv->font_family != NULL)
- family_style = g_strdup (pango_font_family_get_name (priv->font_family));
else
- family_style = g_strdup ("");
+ family_style = g_strdup (pango_font_description_get_family (priv->font_desc));
gtk_label_set_text (GTK_LABEL (font_button->priv->font_label), family_style);
g_free (family_style);
if (font_button->priv->show_size)
{
- gchar *size = g_strdup_printf ("%g",
- pango_font_description_get_size (priv->font_desc) / (double)PANGO_SCALE);
+ /* mirror Pango, which doesn't translate this either */
+ gchar *size = g_strdup_printf ("%g%s",
+ pango_font_description_get_size (priv->font_desc) / (double)PANGO_SCALE,
+ pango_font_description_get_size_is_absolute (priv->font_desc) ? "px" : "");
gtk_label_set_text (GTK_LABEL (font_button->priv->size_label), size);