Ticket #23104: 0001-bug-23104-Add-a-default-line-height-compensation.2.patch

File 0001-bug-23104-Add-a-default-line-height-compensation.2.patch, 2.8 KB (added by igt0, 21 months ago)

Updated patch - Revision 2

  • layout/generic/ReflowInput.cpp

    From 5f1eba22e0aeb10624c099477549c87cab420914 Mon Sep 17 00:00:00 2001
    From: igt0 <igt0-tor@gmail.com>
    Date: Sat, 16 Sep 2017 16:50:17 -0300
    Subject: [PATCH] bug 23104 - Add a default line height compensation
    
    Many fonts have issues with their vertical metrics. they
    are used to influence the height of ascenders and depth
    of descenders. Gecko uses it to calculate the line height
    (font height + ascender + descender), however because of
    that idiosyncratic behavior across multiple operating
    systems, it can be used to identify the user's OS.
    
    The solution proposed in the patch uses a default factor
    to be multiplied with the font size, simulating the concept
    of ascender and descender. This way all operating
    systems will have the same line height.
    ---
     layout/generic/ReflowInput.cpp | 6 +++++-
     modules/libpref/init/all.js    | 3 ++-
     2 files changed, 7 insertions(+), 2 deletions(-)
    
    diff --git a/layout/generic/ReflowInput.cpp b/layout/generic/ReflowInput.cpp
    index 42f4a24..8c7d5ce 100644
    a b enum eNormalLineHeightControl { 
    4646  eUninitialized = -1,
    4747  eNoExternalLeading = 0,   // does not include external leading
    4848  eIncludeExternalLeading,  // use whatever value font vendor provides
    49   eCompensateLeading        // compensate leading if leading provided by font vendor is not enough
     49  eCompensateLeading,       // compensate leading if leading provided by font vendor is not enough
     50  eTorLeading
    5051};
    5152
    5253static eNormalLineHeightControl sNormalLineHeightControl = eUninitialized;
    GetNormalLineHeight(nsFontMetrics* aFontMetrics) 
    27782779    else
    27792780      normalLineHeight = emHeight+ internalLeading + externalLeading;
    27802781    break;
     2782  case eTorLeading:
     2783    normalLineHeight = NSToCoordRound(emHeight * NORMAL_LINE_HEIGHT_FACTOR);
     2784    break;
    27812785  default:
    27822786    //case eNoExternalLeading:
    27832787    normalLineHeight = emHeight + internalLeading;
  • modules/libpref/init/all.js

    diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
    index 57fbe69..b0d14c5 100644
    a b pref("browser.display.force_inline_alttext", false); // true = force ALT text fo 
    247247// 0 = no external leading,
    248248// 1 = use external leading only when font provides,
    249249// 2 = add extra leading both internal leading and external leading are zero
    250 pref("browser.display.normal_lineheight_calc_control", 2);
     250// 3 = Add internal leading
     251pref("browser.display.normal_lineheight_calc_control", 3);
    251252// enable showing image placeholders while image is loading or when image is broken
    252253pref("browser.display.show_image_placeholders", true);
    253254// if browser.display.show_image_placeholders is true then this controls whether the loading image placeholder and border is shown or not