Fix small caps support

This commit is contained in:
Kovid Goyal 2007-08-04 21:57:13 +00:00
parent e6bcc95150
commit 1461146624
2 changed files with 14 additions and 10 deletions

View File

@ -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):

View File

@ -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'>