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']
|
||||
variant = attrs.pop('fontvariant', None)
|
||||
if variant == 'small-caps':
|
||||
tokens = [ i.upper() for i in src.split()]
|
||||
spans = []
|
||||
for i in tokens:
|
||||
f, r = i[0], i[1:]+' '
|
||||
spans.append(f)
|
||||
spans.append(_Span(r, fontsize=normal_font_size-30))
|
||||
src = _Span(fontsize=normal_font_size)
|
||||
for i in spans:
|
||||
src.append(i)
|
||||
dump = _Span(fontsize=normal_font_size-30)
|
||||
temp = []
|
||||
for c in src:
|
||||
if c.isupper():
|
||||
if temp:
|
||||
dump.append(''.join(temp))
|
||||
temp = []
|
||||
dump.append(_Span(c, fontsize=normal_font_size))
|
||||
else:
|
||||
temp.append(c.upper())
|
||||
src = dump
|
||||
if temp:
|
||||
src.append(''.join(temp))
|
||||
|
||||
family, key = attrs['fontfacename']
|
||||
if fonts[family].has_key(key):
|
||||
|
@ -167,7 +167,7 @@
|
||||
</p>
|
||||
<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.
|
||||
</p>
|
||||
<p class='toc'>
|
||||
|
Loading…
x
Reference in New Issue
Block a user