Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ‘uni0453.ital’ and enable support for Macedonian italics #398

Merged
merged 3 commits into from
Oct 27, 2020
Merged

Add ‘uni0453.ital’ and enable support for Macedonian italics #398

merged 3 commits into from
Oct 27, 2020

Conversation

d125q
Copy link
Contributor

@d125q d125q commented Oct 26, 2020

Fixes #394. See also #29.

Comparison

@alerque
Copy link
Owner

alerque commented Oct 26, 2020

Wow thanks for the effort in contributing this @d125q, this looks great — all normalized and everything.

For the sake of my future self in regression testing, could you drop the UTF8 string for the sample above into a comment here?

@d125q
Copy link
Contributor Author

d125q commented Oct 27, 2020

You’re welcome – this is the first time I’ve done anything font-related and it was nice. I used LuaLaTeX to generate the sample, would the source for that help? Otherwise, the six letters are simply бгдптѓ.

@alerque
Copy link
Owner

alerque commented Oct 27, 2020

Yes the LuaLaTeX sources would be great. I try to post sources for such samples (either TeX or SILE) any time there is an issue like this. It makes figuring out regressions later much easier. A year from now if something breaks or needs extending I don't have to try to invent test cases again. Eventually I'd like to make such test specimens part of the project source, but haven't figured out how exactly I want to integrate that with fontship yet. For now I'm just leaving code snippets in related issues.

I'm even more impressed if this was your first foray into fonts and using FontForge! Good work.

@alerque
Copy link
Owner

alerque commented Oct 27, 2020

I just whipped up a small sample in SILE to test this and it looks like there may be a problem with either the right side bearing or some kerning class interaction on the Serif Bold Italic styles. Here it is with a pipe character drawn after your sample word in each style for reference:

image

SILE Code
\begin[papersize=a6]{document}
\nofolios
\neverindent
\define[command=word]{бгдптѓ|}
\define[command=serif]{\font[family=Libertinus Serif]{\word \strong{\word} \em{\word} \em{\strong{\word}} (Serif, \process)\break}}
\define[command=sans]{\font[family=Libertinus Sans]{\word \strong{\word} \em{\word} (Sans, \process)\break}}
\begin{raggedright}
\font[language=ru]{\serif{Russian}}
\font[language=ru]{\sans{Russian}}
\bigskip
\font[language=srb]{\serif{Serbian}}
\font[language=srb]{\sans{Serbian}}
\bigskip
\font[language=mkd]{\serif{Macedonian}}
\font[language=mkd]{\sans{Macedonian}}
\end{raggedright}
\end{document}

I busted out FontForge myself on this and it wasn't immediately apparent to me what the actual problem is. The right bearing looks okay and is in line with similar glyphs.

@d125q
Copy link
Contributor Author

d125q commented Oct 27, 2020

Hmm, that looks very weird to me. What is supposed to be Serif Bold Italic does not resemble the Serif font at all, so maybe SILE’s engine is doing something weird.

Below is a somewhat configurable LuaLaTeX sample. You will need the latest TeX Live to typeset it.

\documentclass[preview]{standalone}

\RequirePackage[american]{babel}
\RequirePackage{enumitem}

\setlist[description]{%
  leftmargin=*,%
  font=\sffamily\bfseries,%
}

\babelprovide[import]{macedonian}
\babelprovide[import]{serbian}
\babelprovide[import]{russian}

\babelfont[american]{rm}[Language=Default]{Libertinus Serif}
\babelfont[american]{sf}[Language=Default]{Libertinus Sans}
\babelfont{tt}[Language=Default,Scale=MatchLowercase]{Libertinus Mono}

\babelfont[macedonian]{rm}[Language=Macedonian]{Libertinus Serif}
\babelfont[macedonian]{sf}[Language=Macedonian]{Libertinus Sans}

\babelfont[serbian]{rm}[Language=Serbian]{Libertinus Serif}
\babelfont[serbian]{sf}[Language=Serbian]{Libertinus Sans}

\babelfont[russian]{rm}[Language=Default]{Libertinus Serif}
\babelfont[russian]{sf}[Language=Default]{Libertinus Sans}

\newcommand{\sampletext}{бгдптѓ/}
\newcommand{\testitem}[2]{%
\item[#1]
  \begin{otherlanguage}{#2}
    \begin{description}[widest=Serif]
    \item[Serif] \rmfamily
      \sampletext{}
      \textbf{\sampletext{}}
      \textit{\sampletext{}}
      \textit{\textbf{\sampletext{}}}
    \item[Sans] \sffamily
      \sampletext{}
      \textbf{\sampletext{}}
      \textit{\sampletext{}}
    \end{description}
  \end{otherlanguage}%
}

\begin{document}
\begin{description}[widest=Macedonian]
  \testitem{Macedonian}{macedonian}
  \testitem{Serbian}{serbian}
  \testitem{Russian}{russian}
\end{description}
\end{document}

% Local Variables:
% fill-column: 80
% mode: latex
% TeX-engine: luatex
% TeX-master: t
% End:

Comparison

@alerque
Copy link
Owner

alerque commented Oct 27, 2020

What is supposed to be Serif Bold Italic does not resemble the Serif font at all, so maybe SILE’s engine is doing something weird.

So it is. I'll work on that separately. With the correct font in play (set using \font[weight=800]{} rather than \strong{}) everything looks good.

Everything except Semibold that is. Can we get Semibold Added to your TeX sample so we can confirm?

@d125q
Copy link
Contributor Author

d125q commented Oct 27, 2020

So it is. I'll work on that separately. With the correct font in play (set using \font[weight=800]{} rather than \strong{}) everything looks good.

Perfect.

Everything except Semibold that is. Can we get Semibold Added to your TeX sample so we can confirm?

Unfortunately, problems also happen here. However, they occur not only with MKD and SRB, but also with the default – the glyphs look completely off. (Note that fontspec and the rest don’t support Semibold natively, so some manual work has to be done.)

LuaLaTeX code
\documentclass[preview]{standalone}

\RequirePackage{xpatch}
\RequirePackage{xcolor}
\RequirePackage[american]{babel}
\RequirePackage{enumitem}

\setlist[description]{%
  leftmargin=*,%
  font=\mdseries\ttfamily,%
}

\babelprovide[import]{macedonian}
\babelprovide[import]{serbian}
\babelprovide[import]{russian}

\NewDocumentCommand{\FontName}{}{Libertinus}
\NewDocumentCommand{\LoadFont}{mo}{%
  \babelfont[#1]{rm}[%
  Language=\IfValueTF{#2}{#2}{Default},%
  FontFace={sb}{n}{\FontName{} Serif Semibold},%
  FontFace={sb}{it}{\FontName{} Serif Semibold Italic},%
  ]{\FontName{} Serif}
  \babelfont[#1]{sf}[%
  Language=\IfValueTF{#2}{#2}{Default},%
  ]{\FontName{} Sans}
  \babelfont[#1]{tt}[%
  Language=Default,%
  Scale=MatchLowercase,%
  FakeStretch=0.8,%
  ]{\FontName{} Mono}
}

\DeclareOldFontCommand{\sbseries}{\fontseries{sb}\selectfont}{\mathbf}
\DeclareTextFontCommand{\textsb}{\sbseries}

\LoadFont{american}
\LoadFont{american}
\LoadFont{macedonian}[Macedonian]
\LoadFont{macedonian}[Macedonian]
\LoadFont{serbian}[Serbian]
\LoadFont{serbian}[Serbian]
\LoadFont{russian}
\LoadFont{russian}

\NewDocumentCommand{\SampleText}{}{бгдптѓ/}
\NewDocumentCommand{\TestItem}{mm}{%
\item[#1]
  \begin{otherlanguage}{#2}
    \begin{description}[widest=\FontName{} Serif]
    \item[\FontName{} Serif]\rmfamily
      \begin{description}[widest=Semibold Italic]
      \item[Regular] \SampleText{}
      \item[Semibold] \textsb{\SampleText{}}
      \item[Bold] \textbf{\SampleText{}}
      \item[Italic] \textit{\SampleText{}}
      \item[Semibold Italic] \textcolor{red}{\textsb{\textit{\SampleText{}}}}
      \item[Bold Italic] \textbf{\textit{\SampleText{}}}
      \end{description}
    \item[\FontName{} Sans]\sffamily
      \begin{description}[widest=Semibold Italic]
      \item[Regular] \SampleText{}
      \item[Bold] \textbf{\SampleText{}}
      \item[Italic] \textit{\SampleText{}}
      \end{description}
    \end{description}
  \end{otherlanguage}%
}

\begin{document}
\begin{description}[widest=MKD]
  \TestItem{MKD}{macedonian}
  \TestItem{SRB}{serbian}
  \TestItem{RUS}{russian}
\end{description}
\end{document}

% Local Variables:
% fill-column: 80
% mode: latex
% TeX-engine: luatex
% TeX-master: t
% End:

Comparison

@alerque
Copy link
Owner

alerque commented Oct 27, 2020

Unfortunately, problems also happen here.

So the issue with SILE was that I wasn't getting the Bold at all, \strong was erroneously defined as weight=600. That explains how that test went sideways.

The remaining issue with Semibold looks like a bigger problem than this PR, and nothing seems worse here. I think I'll go ahead and merge this and we can track Semibold Cyrillic as a separate issue.

@Crissov
Copy link
Contributor

Crissov commented Oct 27, 2020

This is great. I would just like to suggest to use бдгѓийптшщ as the test string.

@alerque
Copy link
Owner

alerque commented Oct 27, 2020

@Crissov Here is a sample with your test string (skipping the known-broken Semibold):

image

SILE Code
\begin[papersize=a6]{document}
\nofolios
\neverindent
\define[command=word]{бдгѓийптшщ}
% \define[command=semibold]{\font[weight=600]{\process}}
\define[command=semibold]{}
\define[command=bold]{\font[weight=700]{\process}}
\define[command=label]{\font[family=Libertinus Sans,size=6pt]{Libertinus \process{}:\break}}
\define[command=serif]{\font[family=Libertinus Serif]{\label{Serif \process}\word \semibold{\word} \bold{\word} \em{\word} \em{\semibold{\word}} \em{\bold{\word}}}\break}
\define[command=sans]{\font[family=Libertinus Sans]{\label{Sans \process}\word \bold{\word} \em{\word}\break}}
\begin{raggedright}
\font[language=ru]{\serif{Russian}}
\font[language=ru]{\sans{Russian}}
\bigskip
\font[language=srb]{\serif{Serbian}}
\font[language=srb]{\sans{Serbian}}
\bigskip
\font[language=mkd]{\serif{Macedonian}}
\font[language=mkd]{\sans{Macedonian}}
\end{raggedright}
\end{document}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for Macedonian italics
3 participants