tor-browser

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

largeop.py (3708B)


      1 #!/usr/bin/env python3
      2 
      3 from utils import mathfont
      4 import fontforge
      5 
      6 nAryWhiteVerticalBarCodePoint = 0x2AFF
      7 v1 = 5 * mathfont.em
      8 f = mathfont.create("largeop-displayoperatorminheight%d" % v1,
      9                    "Copyright (c) 2016 MathML Association")
     10 f.math.DisplayOperatorMinHeight = v1
     11 mathfont.createSquareGlyph(f, nAryWhiteVerticalBarCodePoint)
     12 g = f.createChar(-1, "uni2AFF.display")
     13 mathfont.drawRectangleGlyph(g, mathfont.em, v1, 0)
     14 f[nAryWhiteVerticalBarCodePoint].verticalVariants = "uni2AFF uni2AFF.display"
     15 mathfont.save(f)
     16 
     17 v1 = 3 * mathfont.em
     18 v2 = mathfont.em
     19 f = mathfont.create("largeop-displayoperatorminheight%d-2AFF-axisheight%d" % (v1, v2),
     20                    "Copyright (c) 2025 Igalia S.L.")
     21 f.math.DisplayOperatorMinHeight = v1
     22 f.math.AxisHeight = v2
     23 mathfont.createSquareGlyph(f, nAryWhiteVerticalBarCodePoint)
     24 g = f.createChar(-1, "uni2AFF.display")
     25 p = g.glyphPen()
     26 p.moveTo(0, 0)
     27 p.lineTo(0, v1)
     28 p.lineTo(mathfont.em, v1)
     29 p.lineTo(mathfont.em, 0)
     30 p.closePath()
     31 g.width = mathfont.em
     32 g.italicCorrection = 0
     33 f[nAryWhiteVerticalBarCodePoint].verticalVariants = "uni2AFF uni2AFF.display"
     34 mathfont.save(f)
     35 
     36 v1 = 2 * mathfont.em
     37 v2 = 3 * mathfont.em
     38 f = mathfont.create("largeop-displayoperatorminheight%d-2AFF-italiccorrection%d" % (v1, v2),
     39                    "Copyright (c) 2018 Igalia S.L.")
     40 f.math.DisplayOperatorMinHeight = v1
     41 mathfont.createSquareGlyph(f, nAryWhiteVerticalBarCodePoint)
     42 g = f.createChar(-1, "uni2AFF.display")
     43 p = g.glyphPen()
     44 p.moveTo(0, 0)
     45 p.lineTo(v2, v1)
     46 p.lineTo(v2 + mathfont.em, v1)
     47 p.lineTo(mathfont.em, 0)
     48 p.closePath()
     49 g.width = mathfont.em + v2
     50 g.italicCorrection = v2
     51 f[nAryWhiteVerticalBarCodePoint].verticalVariants = "uni2AFF uni2AFF.display"
     52 mathfont.save(f)
     53 
     54 v1 = 7 * mathfont.em
     55 v2 = 5 * mathfont.em
     56 f = mathfont.create("largeop-displayoperatorminheight%d-2AFF-italiccorrection%d" % (v1, v2),
     57                    "Copyright (c) 2020 Igalia S.L.")
     58 f.math.DisplayOperatorMinHeight = v1
     59 f.math.MinConnectorOverlap = 0
     60 mathfont.createSquareGlyph(f, nAryWhiteVerticalBarCodePoint)
     61 g = f.createChar(-1, "uni2AFF.bot")
     62 mathfont.drawRectangleGlyph(g,
     63                            width=2 * mathfont.em,
     64                            ascent=mathfont.em)
     65 g = f.createChar(-1, "uni2AFF.ext")
     66 mathfont.drawRectangleGlyph(g,
     67                            width=mathfont.em,
     68                            ascent=2 * mathfont.em,
     69                            padding_left=mathfont.em)
     70 g = f.createChar(-1, "uni2AFF.top")
     71 mathfont.drawRectangleGlyph(g,
     72                            width=v2 + mathfont.em,
     73                            ascent=mathfont.em,
     74                            padding_left=mathfont.em)
     75 f[nAryWhiteVerticalBarCodePoint].verticalVariants = "uni2AFF"
     76 # Part: (glyphName, isExtender, startConnector, endConnector, fullAdvance)
     77 f[nAryWhiteVerticalBarCodePoint].verticalComponents = \
     78    (("uni2AFF.bot", False, 0, mathfont.em // 2, mathfont.em),
     79     ("uni2AFF.ext", True, mathfont.em // 2, mathfont.em // 2, 2 * mathfont.em),
     80     ("uni2AFF.top", False, mathfont.em // 2, 0, mathfont.em)
     81     )
     82 f[nAryWhiteVerticalBarCodePoint].verticalComponentItalicCorrection = v2
     83 mathfont.save(f)
     84 
     85 v1 = int(1.25 * mathfont.em)
     86 f = mathfont.create("largeop-displayoperatorminheight%d" % v1,
     87                    "Copyright (c) 2025 Igalia S.L.")
     88 f.math.DisplayOperatorMinHeight = v1
     89 f.math.AxisHeight = int(v1 / 2)
     90 mathfont.createSquareGlyph(f, nAryWhiteVerticalBarCodePoint)
     91 g = f.createChar(-1, "uni2AFF.v1")
     92 mathfont.drawRectangleGlyph(g, mathfont.em, v1, 0)
     93 g = f.createChar(-1, "uni2AFF.v2")
     94 mathfont.drawRectangleGlyph(g, mathfont.em, 2 * mathfont.em, 0)
     95 f[nAryWhiteVerticalBarCodePoint].verticalVariants = "uni2AFF uni2AFF.v1 uni2AFF.v2"
     96 mathfont.save(f)