Skip to content

Commit

Permalink
Get CMU font only for Russian text
Browse files Browse the repository at this point in the history
We want custom CMU Serif Roman to be used only for specific Russian text
and the main font to be default.
  • Loading branch information
enzet committed Aug 16, 2024
1 parent fe84e3d commit e0365b3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
../fonts/DoulosSIL-Regular.ttf
../fonts/NotoSansKR-Regular.ttf
../fonts/cmunrm.ttf
../fonts/cmunrb.ttf
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
Expand Down
12 changes: 10 additions & 2 deletions data/text.moi
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,15 @@ Or Cyrillic (see table \tex_ref {tbl:model_cyrillic}).
\table
{tbl:model_cyrillic}
{Modeling Cyrillic symbols}
{{Existing symbol} {Г} {Ж} {И} {П} {Ш} {Э}}
{
{Existing symbol}
{\ru {Г}}
{\ru {Ж}}
{\ru {И}}
{\ru {П}}
{\ru {Ш}}
{\ru {Э}}
}
{
{Proposed system}
{\symbol {vl ht}}
Expand Down Expand Up @@ -420,7 +428,7 @@ recognizable.
\table
{tbl:model_other}
{Modeling other symbols}
{{Existing symbol} {A} {M} {Y} {У} {Ф} {Ч}}
{{Existing symbol} {A} {M} {Y} {\ru {У}} {\ru {Ф}} {\ru {Ч}}}
{
{Proposed system}
{\symbol {vl hto hc vr}}
Expand Down
9 changes: 8 additions & 1 deletion python/moire_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ def ko(self, arg) -> str:
"""Korean text symbol."""
raise NotImplementedError()

def ru(self, arg) -> str:
"""Russian text symbol."""
raise NotImplementedError()

def symbol(self, arg) -> str:
raise NotImplementedError()

Expand All @@ -41,9 +45,9 @@ def body(self, arg) -> str:
\\usepackage{tikz}
\\usepackage{fontspec}
\\usepackage[left=1.25in,right=1.25in,top=1in,bottom=1in]{geometry}
\\setmainfont[Ligatures=TeX]{CMU Serif Roman}
\\newfontface\\doulos{Doulos SIL}
\\newfontface\\ko{Noto Sans KR Regular}
\\newfontface\\ru{CMU Serif Roman}
\\def\\arraystretch{1.3}
\\usetikzlibrary{positioning}
\\begin{document}
Expand Down Expand Up @@ -129,6 +133,9 @@ def ipa(self, arg) -> str:
def ko(self, arg) -> str:
return f"{{\\ko{{{self.parse(arg[0])}}}}}"

def ru(self, arg) -> str:
return f"{{\\ru{{{self.parse(arg[0])}}}}}"

def tikz_symbol(self, arg) -> str:
proc: subprocess.Popen = subprocess.Popen(
[SYMBOL_GENERATOR_EXECUTABLE, "symbol"]
Expand Down

0 comments on commit e0365b3

Please sign in to comment.