mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Handle negative font sizes better.
This commit is contained in:
parent
724c852a4c
commit
efabf65955
@ -125,10 +125,15 @@ class Span(_Span):
|
|||||||
|
|
||||||
|
|
||||||
def font_size(val):
|
def font_size(val):
|
||||||
|
# Assumes a 10 pt font (14 pixels) has fontsize 100
|
||||||
ans = None
|
ans = None
|
||||||
unit = Span.unit_convert(val, dpi, 14)
|
normal = 14
|
||||||
|
unit = Span.unit_convert(val, dpi, normal)
|
||||||
if unit:
|
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)
|
ans = int(unit * (72./dpi) * 10)
|
||||||
else:
|
else:
|
||||||
if "xx-small" in val:
|
if "xx-small" in val:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user