mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-26 19:33:03 +02:00
Handle negative font sizes better.
This commit is contained in:
parent
724c852a4c
commit
efabf65955
1 changed files with 7 additions and 2 deletions
|
|
@ -125,10 +125,15 @@ def font_key(family, style, weight):
|
|||
|
||||
|
||||
def font_size(val):
|
||||
# Assumes a 10 pt font (14 pixels) has fontsize 100
|
||||
ans = None
|
||||
unit = Span.unit_convert(val, dpi, 14)
|
||||
normal = 14
|
||||
unit = Span.unit_convert(val, dpi, normal)
|
||||
if unit:
|
||||
# Assume a 10 pt font (14 pixels) has fontsize 100
|
||||
if unit < 0:
|
||||
unit = normal + unit
|
||||
if unit < 0:
|
||||
unit = normal
|
||||
ans = int(unit * (72./dpi) * 10)
|
||||
else:
|
||||
if "xx-small" in val:
|
||||
|
|
|
|||
Loading…
Reference in a new issue