tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

stretchy-centered-on-baseline.py (1622B)


      1 #!/usr/bin/env python3
      2 
      3 from utils import mathfont
      4 import fontforge
      5 
      6 # Create a WOFF font with glyphs for all the operator strings.
      7 font = mathfont.create("stretchy-centered-on-baseline",
      8                       "Copyright (c) 2023 Igalia S.L.")
      9 
     10 # Set parameters for stretchy tests.
     11 font.math.MinConnectorOverlap = mathfont.em // 2
     12 
     13 # Make sure that underover parameters don't add extra spacing.
     14 font.math.LowerLimitBaselineDropMin = 0
     15 font.math.LowerLimitGapMin = 0
     16 font.math.StretchStackBottomShiftDown = 0
     17 font.math.StretchStackGapAboveMin = 0
     18 font.math.UnderbarVerticalGap = 0
     19 font.math.UnderbarExtraDescender = 0
     20 font.math.UpperLimitBaselineRiseMin = 0
     21 font.math.UpperLimitGapMin = 0
     22 font.math.StretchStackTopShiftUp = 0
     23 font.math.StretchStackGapBelowMin = 0
     24 font.math.OverbarVerticalGap = 0
     25 font.math.AccentBaseHeight = 0
     26 font.math.OverbarExtraAscender = 0
     27 
     28 # These two characters will be stretchable in both directions.
     29 horizontalArrow = 0x295A  # LEFTWARDS HARPOON WITH BARB UP FROM BAR
     30 verticalArrow = 0x295C  # UPWARDS HARPOON WITH BARB RIGHT FROM BAR
     31 
     32 mathfont.createSizeVariants(font, aUsePUA=True, aCenterOnBaseline=True)
     33 
     34 # Add stretchy vertical and horizontal constructions for the horizontal arrow.
     35 mathfont.createSquareGlyph(font, horizontalArrow)
     36 mathfont.createStretchy(font, horizontalArrow, True)
     37 mathfont.createStretchy(font, horizontalArrow, False)
     38 
     39 # Add stretchy vertical and horizontal constructions for the vertical arrow.
     40 mathfont.createSquareGlyph(font, verticalArrow)
     41 mathfont.createStretchy(font, verticalArrow, True)
     42 mathfont.createStretchy(font, verticalArrow, False)
     43 
     44 mathfont.save(font)