[vte/wip/rishi/fonts-pangocairo-height-ascent-measure-cleanup] font: pangocairo: Remove redundant code




commit b335bba49e67e89e4a8143148479bc6451d4a289
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed May 12 03:29:34 2021 +0200

    font: pangocairo: Remove redundant code
    
    The max_height variable is initialized as 1, and then iteratively
    updated to track the maximum height of all the characters from U+0021
    to U+007E. The final value is assined to m_height. Hence m_height can
    never be zero.
    
    In the case of m_ascent, the contents of m_layout don't change between
    the two places where it's assigned. Therefore, the second assignment is
    redundant.
    
    https://gitlab.gnome.org/GNOME/vte/-/issues/355

 src/fonts-pangocairo.cc | 7 -------
 1 file changed, 7 deletions(-)
---
diff --git a/src/fonts-pangocairo.cc b/src/fonts-pangocairo.cc
index e77981b5..3fa24f64 100644
--- a/src/fonts-pangocairo.cc
+++ b/src/fonts-pangocairo.cc
@@ -201,13 +201,6 @@ FontInfo::measure_font()
        /* Now that we shaped the entire ASCII character string, cache glyph
         * info for them */
        cache_ascii();
-
-       if (m_height == 0) {
-               m_height = PANGO_PIXELS_CEIL (logical.height);
-       }
-       if (m_ascent == 0) {
-               m_ascent = PANGO_PIXELS_CEIL(pango_layout_get_baseline(m_layout.get()));
-       }
 }
 
 FontInfo::FontInfo(vte::glib::RefPtr<PangoContext> context)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]