TransWikia.com

Resize single character from certain font

TeX - LaTeX Asked by mac on January 5, 2021

I use Kerkis Sans greek font as a secondary font in my documents, for titles, paragraphs etc. As I’ve been testing the font I noticed that the capital greek F (Φ) is much smaller that the rest of the letters. My attempt to resize it was this

documentclass[english,greek]{article}
usepackage[T1]{fontenc}
usepackage{babel}
usepackage{txfontsb,graphicx}

newcommand{kerkissans}[1]{{fontfamily{maksf}selectfont #1}}


begin{document}
ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ
kerkissans{ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ}
kerkissans{textbf{ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ}}
kerkissans{textbf{resizebox{!}{6pt}{Φ}Φ}}
end{document}

enter image description here

The problems I face are

  1. This issue appears only with Kerkis Sans font and only when the text is bold
  2. My attempt fixes the size locally

Is there a way to resize the bold Φ globally?

One Answer

The bug should be reported to the maintainer of Kerkis.

In the meantime, you can do as follows:

documentclass[english,greek]{article}
usepackage[T1]{fontenc}
usepackage{babel}
usepackage{txfontsb}
usepackage{graphicx}
usepackage{newunicodechar}
usepackage{xparse}

newcommand{kerkissans}[1]{{fontfamily{maksf}selectfont #1}}

newunicodechar{Φ}{FIXEDPHI}

ExplSyntaxOn
NewDocumentCommand{FIXEDPHI}{}
 {
  str_if_eq:eeTF { use:c { f@family } } { maksf }
   {
    str_if_in:enTF { use:c { f@series } } { b }
     { resizebox{!}{fontcharhtfont`A}{F} +}
     { F }
   }
   { F }
 }
prg_generate_conditional_variant:Nnn str_if_in:nn { e } { T, F, TF }
ExplSyntaxOff


begin{document}

ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ

kerkissans{ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ}

kerkissans{textit{ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ}}

kerkissans{textbf{ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ}}

kerkissans{textit{textbf{ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ}}}

end{document}

I added a + in order to show that the fix is applied only when necessary, that is, when the font series is bold (also bold italic has the bug).

In the production version, remove the +:

NewDocumentCommand{FIXEDPHI}{}
 {
  str_if_eq:eeTF { use:c { f@family } } { maksf }
   {
    str_if_in:enTF { use:c { f@series } } { b }
     { resizebox{!}{fontcharhtfont`A}{F} }
     { F }
   }
   { F }
 }

Output with the + for debugging

enter image description here

Output with the production version

enter image description here

Correct answer by egreg on January 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP