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

Ligatures for Hasklig #25

Open
tonyday567 opened this issue Feb 24, 2018 · 2 comments
Open

Ligatures for Hasklig #25

tonyday567 opened this issue Feb 24, 2018 · 2 comments

Comments

@tonyday567
Copy link

I followed the instructions for converting a font to SVG for the Hasklig font, specifically Hasklig-Regular.otf that was part of the 1.1 release downloadable from here.

The method worked well but, alas, there were no ligature effects. Code to reproduce:

import qualified Data.Text.Lazy.IO as Text
import Graphics.Text
import Diagrams.Backend.SVG
import qualified Diagrams.Prelude as D
import Graphics.SVGFonts

toSvg = D.renderDia SVG (SVGOptions (D.mkSizeSpec (D.V2 (Just 600) (Just 400))) Nothing "id" [] True)

toFile f = Text.writeFile f . prettyText

toDia f = textSVG_ (TextOpts f INSIDE_H KERN False 0.1 0.1)

main = do
  font <- loadFont "other/Hasklig-Regular.svg"
  toFile "example.svg" . toSvg . toDia font $ "0123 <* <*> <$> <| |> <|> <> <- -> => >>= =<< :: ++ /= =="

Any thoughts?

Tony

@tkvogt
Copy link
Member

tkvogt commented Feb 24, 2018

It seems fontforge doesn't generate any ligatures from the otf file.

@ygale
Copy link

ygale commented Dec 18, 2019

When converting to an SVG font, FontForge doesn't include glyphs that are constructed using code. For example, if the font constructs ligatures by assembling them from shared fragments, they won't show up in the SVG font. You'll only get ligatures that are fully specified with their own outline graphics. I'm guessing that's what happened here.

However, you do get all the fragments. They appear in the SVG font as glyphs that are not bound to any Unicode sequence. Perhaps you can figure out how to assemble them yourself using diagrams code.

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

No branches or pull requests

3 participants