Open pcdi opened 2 months ago
It's not possible at the moment. Since the fontspec
script tag is ambiguous in this case (CJK
in both cases), one way is to check additionally for bcp47-script. Then you could set:
\newfontfamily\hansfont[Script=CJK,Language=Chinese Simplified]{Source Han Sans SC}
\newfontfamily\hantfont[Script=CJK,Language=Chinese Traditional]{Source Han Sans TC}
I have implemented this in master. If you can test the development version, that would be great (note, though, that due to our major code rewrite, you would need to download the whole tex directory).
@Udi-Fogiel I am getting an automated test run failure after this commit, but I cannot make sense of it.
It's not possible at the moment. Since the
fontspec
script tag is ambiguous in this case (CJK
in both cases), one way is to check additionally for bcp47-script.
Maybe we can add an option for the user to decide on the name of the font switch command associated with a language/variant/alias, it seems more general.
@Udi-Fogiel I am getting an automated test run failure after this commit, but I cannot make sense of it.
This is due a change in the format of messages from fontspec, see:
https://github.com/latex3/fontspec/commit/844c653ad9326bda004d2ad0e36470141b33cc07
You can run the tests locally by l3build check
(for more options see l3build
's documentation), and if there are failures, there should be .diff files in build/test
showing the changes.
I'll update the tests in the following hour.
Maybe we can add an option for the user to decide on the name of the font switch command associated with a language/variant/alias, it seems more general.
At the moment I do not see the need for that.
I'll update the tests in the following hour.
Thanks!
Maybe we can add an option for the user to decide on the name of the font switch command associated with a language/variant/alias, it seems more general.
At the moment I do not see the need for that.
Well, this ticket was about different fonts for different variants, and it is not really possible right now...
Simplified and traditional Chinese characters are different in detail, even though they often share the same basic glyphs (see Han Unification). Therefore, I would like to be able to select two different fonts that reflect these graphical differences between simplified and traditional characters, even if used within the same document. Currently,
simplified
andtraditional
are treated as different variants of the languagechinese
. However, because it is only possible to define a font for a certain language (or script, for that matter) and not for a language variant, it is not possible to use dedicated fonts for both simplified and traditional characters at the same time.I tried going through language aliases, as follows, which does not work, as
\chinesefont
never gets defined.If you have a font that is able to switch glyphs based on the language it is invoked with (Such as the Source Han Sans/Serif series), then it is possible to get the correct glyph shapes by adding the language as a
fontfeature
, but this makes it extremely dependent on the font used and totally different fonts for simplified/traditional characters are not possible at all.