Skip to content

Commit

Permalink
show another way to support smallcaps for non-ASCII characters
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Jan 29, 2024
1 parent 76a2d60 commit c6bf7c7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/modules/theme/pages/text.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,21 @@ class MyPDFConverter < (Asciidoctor::Converter.for 'pdf')
end
----
This transformation can be automated using `String#unicode_normalize` with the `:nfd` form.
This method will rewrite all characters with diacritical marks so that the diacritical mark is added using a combining character (i.e., a two graphene form).
[,ruby]
----
class MyPDFConverter < (Asciidoctor::Converter.for 'pdf')
register_for 'pdf'

def smallcaps string
string = string.unicode_normalize :nfd unless string.ascii_only?
super
end
end
----
The smallcaps transformation for extended Latin characters (e.g., characters that include an accent) typically requires the addition of a combining character, such as the combining acute accent in the example above).
Therefore, you must ensure that the font you're using supports these combining characters (meaning it provides the necessary glyphs).
Expand Down

0 comments on commit c6bf7c7

Please sign in to comment.