I’m trying to use different weight for CJK characters in different elements. For example, use “bold”-weight of font Source Han Serif in heading, but “regular”-weight of Source Han Sans in strong. But latin characters are shown with “bold” weight in both cases.
I found it impossible to achieve by setting show regex("\\p{Han}" suggested in this post as the regex show rules will apply globally. If I set such a rule in one element, it would affect all after that element.
Regex show rules don’t need to apply globally, you can apply them to specific elements or scopes.
#let b-to-p(body) = {
show regex("[Bb]"): it => (B: "P", b: "p").at(it.text)
body
}
// now we can apply the rule where we want to
#b-to-p[
Banana and biscuits.
#table[Abc.]
]
#show heading: b-to-p
= Banana
But this text is safe from modification of b's.
Besides, I recommend replace show-func with show-set whenever possible, especially for template authors.
The reason is that show-func rules are hard to override. See Which show rule takes precedence? for explanation.
Maybe you could install SourceHanSans-Regular alone (without other weights)…