~ubuntu-branches/ubuntu/gutsy/firefox/gutsy

« back to all changes in this revision

Viewing changes to gfx/src/gtk/nsFontMetricsPango.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Ian Jackson
  • Date: 2006-10-10 18:49:32 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20061010184932-da75izt7y0e59afq
Tags: 1.99+2.0rc2+dfsg-0ubuntu1
* New upstream version 2.0rc2.
* Fix/workaround for epiphany GtkSocket lifetype crash:
  apply patch id=241087 from Mozilla Bugzilla #241535 to fix LP #63814.
* Change application name to `Firefox', as requested by mdz.
  Files changed:
    - browser/locales/en-US/chrome/branding/brand.dtd
    - browser/locales/en-US/chrome/branding/brand.properties;
  New values:
    - brandShortName and brandFullName: `Bon Echo' => `Firefox'
    - vendorShortName: `Mozilla' => `Ubuntu'
* Make preferences dialogue fit again (bah!).

Show diffs side-by-side

added added

removed removed

Lines of Context:
836
836
        NS_WARNING("nsFontMetricsPango::GetBoundingMetrics invalid unicode to follow");
837
837
        DUMP_PRUNICHAR(aString, aLength)
838
838
#endif
839
 
        aBoundingMetrics.leftBearing = 0;
840
 
        aBoundingMetrics.rightBearing = 0;
841
 
        aBoundingMetrics.width = 0;
842
 
        aBoundingMetrics.ascent = 0;
843
 
        aBoundingMetrics.descent = 0;
 
839
        aBoundingMetrics.Clear();
844
840
 
845
841
        rv = NS_ERROR_FAILURE;
846
842
        goto loser;
847
843
    }
848
844
 
849
 
    pango_layout_set_text(layout, text, strlen(text));
 
845
    pango_layout_set_text(layout, text, -1);
850
846
    FixupSpaceWidths(layout, text);
851
847
 
852
 
    // Get the logical extents
853
848
    PangoLayoutLine *line;
854
849
    if (pango_layout_get_line_count(layout) != 1) {
855
850
        printf("Warning: more than one line!\n");
856
851
    }
857
852
    line = pango_layout_get_line(layout, 0);
858
853
 
859
 
    // Get the ink extents
860
 
    PangoRectangle rect;
861
 
    pango_layout_line_get_extents(line, NULL, &rect);
 
854
    // Get the ink and logical extents
 
855
    PangoRectangle ink, logical;
 
856
    pango_layout_line_get_extents(line, &ink, &logical);
862
857
 
863
858
    float P2T;
864
859
    P2T = mDeviceContext->DevUnitsToAppUnits();
865
860
 
866
 
    aBoundingMetrics.leftBearing =
867
 
        NSToCoordRound(rect.x * P2T / PANGO_SCALE);
868
 
    aBoundingMetrics.rightBearing =
869
 
        NSToCoordRound(rect.width * P2T / PANGO_SCALE);
870
 
    aBoundingMetrics.width = NSToCoordRound((rect.x + rect.width) * P2T / PANGO_SCALE);
871
 
    aBoundingMetrics.ascent = NSToCoordRound(rect.y * P2T / PANGO_SCALE);
872
 
    aBoundingMetrics.descent = NSToCoordRound(rect.height * P2T / PANGO_SCALE);
 
861
    aBoundingMetrics.leftBearing  = NSToCoordRound(PANGO_LBEARING(ink) * P2T / PANGO_SCALE);
 
862
    aBoundingMetrics.rightBearing = NSToCoordRound(PANGO_RBEARING(ink) * P2T / PANGO_SCALE);
 
863
    aBoundingMetrics.ascent       = NSToCoordRound(PANGO_ASCENT(ink)   * P2T / PANGO_SCALE);
 
864
    aBoundingMetrics.descent      = NSToCoordRound(PANGO_DESCENT(ink)  * P2T / PANGO_SCALE);
 
865
    aBoundingMetrics.width        = NSToCoordRound(logical.width       * P2T / PANGO_SCALE);
873
866
 
874
867
 loser:
875
868
    g_free(text);