~ubuntu-branches/ubuntu/vivid/clutter-1.0/vivid-proposed

« back to all changes in this revision

Viewing changes to clutter/clutter-text.c

  • Committer: Package Import Robot
  • Author(s): Sjoerd Simons
  • Date: 2013-03-15 23:20:40 UTC
  • mto: (4.1.25 experimental) (1.5.1)
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: package-import@ubuntu.com-20130315232040-9wwd4f9mgx8lewoz
Tags: upstream-1.13.8
ImportĀ upstreamĀ versionĀ 1.13.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
408
408
  if (priv->effective_attrs != NULL)
409
409
    return;
410
410
 
411
 
  /* same as if we don't have any attribute at all */
412
 
  if (priv->attrs == NULL && priv->markup_attrs == NULL)
 
411
  /* Same as if we don't have any attribute at all.
 
412
   * We also ignore markup attributes for editable. */
 
413
  if (priv->attrs == NULL && (priv->editable || priv->markup_attrs == NULL))
413
414
    return;
414
415
 
415
416
  if (priv->attrs != NULL)
416
417
    {
417
 
      /* If there are no markup attributes then we can just use
418
 
         these attributes directly */
419
 
      if (priv->markup_attrs == NULL)
 
418
      /* If there are no markup attributes, or if this is editable (in which
 
419
       * case we ignore markup), then we can just use these attrs directly */
 
420
      if (priv->editable || priv->markup_attrs == NULL)
420
421
        priv->effective_attrs = pango_attr_list_ref (priv->attrs);
421
422
      else
422
423
        {
507
508
  else
508
509
    pango_layout_set_text (layout, contents, contents_len);
509
510
 
510
 
  if (!priv->editable)
511
 
    {
512
 
      /* This will merge the markup attributes and the attributes
513
 
         property if needed */
514
 
      clutter_text_ensure_effective_attributes (text);
 
511
  /* This will merge the markup attributes and the attributes
 
512
   * property if needed */
 
513
  clutter_text_ensure_effective_attributes (text);
515
514
 
516
 
      if (priv->effective_attrs != NULL)
517
 
        pango_layout_set_attributes (layout, priv->effective_attrs);
518
 
    }
 
515
  if (priv->effective_attrs != NULL)
 
516
    pango_layout_set_attributes (layout, priv->effective_attrs);
519
517
 
520
518
  pango_layout_set_alignment (layout, priv->alignment);
521
519
  pango_layout_set_single_paragraph_mode (layout, priv->single_line_mode);
557
555
 * @desc: a #PangoFontDescription
558
556
 *
559
557
 * Sets @desc as the font description to be used by the #ClutterText
560
 
 * actor. The font description ownership is transferred to @self so
561
 
 * the #PangoFontDescription must not be freed after this function
 
558
 * actor. The #PangoFontDescription is copied.
562
559
 *
563
560
 * This function will also set the :font-name field as a side-effect
564
561
 *
571
568
{
572
569
  ClutterTextPrivate *priv = self->priv;
573
570
 
574
 
  if (priv->font_desc == desc)
 
571
  if (priv->font_desc == desc ||
 
572
      pango_font_description_equal (priv->font_desc, desc))
575
573
    return;
576
574
 
577
575
  if (priv->font_desc != NULL)
578
576
    pango_font_description_free (priv->font_desc);
579
577
 
580
 
  priv->font_desc = desc;
 
578
  priv->font_desc = pango_font_description_copy (desc);
581
579
 
582
580
  /* update the font name string we use */
583
581
  g_free (priv->font_name);
619
617
      font_desc = pango_font_description_from_string (font_name);
620
618
      clutter_text_set_font_description_internal (text, font_desc);
621
619
 
 
620
      pango_font_description_free (font_desc);
622
621
      g_free (font_name);
623
622
    }
624
623
 
4918
4917
clutter_text_set_font_description (ClutterText          *self,
4919
4918
                                   PangoFontDescription *font_desc)
4920
4919
{
4921
 
  PangoFontDescription *copy;
4922
 
 
4923
4920
  g_return_if_fail (CLUTTER_IS_TEXT (self));
4924
4921
 
4925
 
  copy = pango_font_description_copy (font_desc);
4926
 
  clutter_text_set_font_description_internal (self, copy);
 
4922
  clutter_text_set_font_description_internal (self, font_desc);
4927
4923
}
4928
4924
 
4929
4925
/**
5007
5003
      else
5008
5004
        {
5009
5005
          /* last fallback */
5010
 
          default_font_name = g_strdup ("Sans 12");
 
5006
          font_name = g_strdup ("Sans 12");
5011
5007
        }
5012
5008
 
5013
5009
      is_default_font = TRUE;
5021
5017
    goto out;
5022
5018
 
5023
5019
  desc = pango_font_description_from_string (font_name);
5024
 
  if (!desc)
 
5020
  if (desc == NULL)
5025
5021
    {
5026
5022
      g_warning ("Attempting to create a PangoFontDescription for "
5027
5023
                 "font name '%s', but failed.",
5035
5031
 
5036
5032
  g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_FONT_NAME]);
5037
5033
 
 
5034
  pango_font_description_free (desc);
 
5035
 
5038
5036
out:
5039
5037
  if (is_default_font)
5040
5038
    g_free ((gchar *) font_name);
5423
5421
 
5424
5422
  priv = self->priv;
5425
5423
 
 
5424
  /* While we should probably test for equality, Pango doesn't
 
5425
   * provide us an easy method to check for AttrList equality.
 
5426
   */
 
5427
  if (priv->attrs == attrs)
 
5428
    return;
 
5429
 
5426
5430
  if (attrs)
5427
5431
    pango_attr_list_ref (attrs);
5428
5432