mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix small caps support
This commit is contained in:
parent
e6bcc95150
commit
1461146624
@ -229,15 +229,19 @@ class Span(_Span):
|
|||||||
normal_font_size = attrs['fontsize']
|
normal_font_size = attrs['fontsize']
|
||||||
variant = attrs.pop('fontvariant', None)
|
variant = attrs.pop('fontvariant', None)
|
||||||
if variant == 'small-caps':
|
if variant == 'small-caps':
|
||||||
tokens = [ i.upper() for i in src.split()]
|
dump = _Span(fontsize=normal_font_size-30)
|
||||||
spans = []
|
temp = []
|
||||||
for i in tokens:
|
for c in src:
|
||||||
f, r = i[0], i[1:]+' '
|
if c.isupper():
|
||||||
spans.append(f)
|
if temp:
|
||||||
spans.append(_Span(r, fontsize=normal_font_size-30))
|
dump.append(''.join(temp))
|
||||||
src = _Span(fontsize=normal_font_size)
|
temp = []
|
||||||
for i in spans:
|
dump.append(_Span(c, fontsize=normal_font_size))
|
||||||
src.append(i)
|
else:
|
||||||
|
temp.append(c.upper())
|
||||||
|
src = dump
|
||||||
|
if temp:
|
||||||
|
src.append(''.join(temp))
|
||||||
|
|
||||||
family, key = attrs['fontfacename']
|
family, key = attrs['fontfacename']
|
||||||
if fonts[family].has_key(key):
|
if fonts[family].has_key(key):
|
||||||
|
@ -167,7 +167,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<p><span style="font-variant: small-caps">This is an example</span> of small-caps.
|
<p><span style="font-variant: small-caps">This is an Example</span> of small-caps.
|
||||||
It can also be used to highlight the start of a paragraph very effectively.
|
It can also be used to highlight the start of a paragraph very effectively.
|
||||||
</p>
|
</p>
|
||||||
<p class='toc'>
|
<p class='toc'>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user