@@ -469,10 +469,16 @@ def _accented(cp, base_name, mark_name, gap=20, x_adj=0):
469469 _make_accented (font , cp , base , '_caron_mark' )
470470
471471# ď ť ľ (lowercase) / Ľ (uppercase): raised apostrophe to the right.
472- _make_dstroke (font , 0x010F , 'd' , gap = - 30 )
473- _make_dstroke (font , 0x0165 , 't' , gap = - 50 )
474- _make_dstroke (font , 0x013E , 'l' , gap = - 50 , width_extra = 80 )
475- _make_dstroke (font , 0x013D , 'L' , gap = - 50 , dy_offset = 100 , width_extra = 80 )
472+ if bodyname == 'xkcd-script-mono' :
473+ _make_dstroke (font , 0x010F , 'd' , gap = - 80 )
474+ _make_dstroke (font , 0x0165 , 't' , gap = - 100 )
475+ _make_dstroke (font , 0x013E , 'l' , gap = - 140 , width_extra = 40 )
476+ _make_dstroke (font , 0x013D , 'L' , gap = - 140 , dy_offset = 100 , width_extra = 40 )
477+ else :
478+ _make_dstroke (font , 0x010F , 'd' , gap = - 30 )
479+ _make_dstroke (font , 0x0165 , 't' , gap = - 50 )
480+ _make_dstroke (font , 0x013E , 'l' , gap = - 50 , width_extra = 80 )
481+ _make_dstroke (font , 0x013D , 'L' , gap = - 50 , dy_offset = 100 , width_extra = 80 )
476482
477483# ---------------------------------------------------------------------------
478484# L with stroke: Ł U+0141 / ł U+0142
@@ -507,23 +513,26 @@ def _make_l_crossbar_mark(font, name, bar_width, rotation=0):
507513
508514
509515def _make_lslash (font , cp , base_name , crossbar_name , y_frac , x_center ):
510- """L-with-stroke: base glyph + crossbar mark at (x_center, y_frac * height)."""
516+ """L-with-stroke: base glyph + crossbar mark at (x_center, y_frac * height).
517+
518+ The x-direction is based on the bounding box, and the y-direction is based on the font baseline.
519+ """
511520 c = font .createMappedChar (cp )
512521 c .clear ()
513522 c .addReference (base_name )
514523 c .width = font [base_name ].width
515524 base_bb = font [base_name ].boundingBox ()
516525 target_y = base_bb [1 ] + (base_bb [3 ] - base_bb [1 ]) * y_frac
517- c .addReference (crossbar_name , psMat .translate (x_center , target_y ))
526+ c .addReference (crossbar_name , psMat .translate (base_bb [ 0 ] + x_center , target_y ))
518527 return c
519528
520529
521530_l_crossbar = _make_l_crossbar_mark (font , '_l_crossbar' , bar_width = 300 , rotation = 40 )
522531
523532# Ł U+0141 — crossbar at 42% of cap height, centered on the vertical stroke (x≈75)
524- _make_lslash (font , 0x0141 , 'L' , '_l_crossbar' , y_frac = 0.42 , x_center = 75 )
533+ _make_lslash (font , 0x0141 , 'L' , '_l_crossbar' , y_frac = 0.42 , x_center = 55 )
525534# ł U+0142 — crossbar at 60% of ascender height, l's stroke is at x≈75
526- _make_lslash (font , 0x0142 , 'l' , '_l_crossbar' , y_frac = 0.60 , x_center = 75 )
535+ _make_lslash (font , 0x0142 , 'l' , '_l_crossbar' , y_frac = 0.60 , x_center = 55 )
527536
528537
529538# ---------------------------------------------------------------------------
0 commit comments