Skip to content

Allow documents and modules to register artificial or pre-configured font-families #5455

Closed as duplicate

Description

@terefang

Description

today in CSS i can:

@font-face {
  font-family: Conduit;
  src: url("./conduit-itc-std.otf");
  font-style: normal;
}

@font-face {
  font-family: Conduit;
  src: url("./conduit-itc-std-bold.otf");
  font-weight: bold;
}

@font-face {
  font-family: Conduit;
  src: url("./conduit-itc-std-italic.otf");
  font-style: italic;
}

@font-face {
  font-family: Conduit;
  src: url("./conduit-itc-std-bolditalic.otf");
  font-weight: bold;
  font-style: italic;
}

could this be supported in typst with script similar to:

#font.face(family: "Conduit", src: "./conduit-itc-std.otf", style: "normal")
#font.face(family: "Conduit", src: "./conduit-itc-std-bold.otf", weight: "bold")
#font.face(family: "Conduit", src: "./conduit-itc-std-italic.otf", style: "italic")
#font.face(family: "Conduit", src: "./conduit-itc-std-bolditalic.otf", weight: "bold", style: "italic")

Use Case

prior art would be the CSS spec.

the actual use-cases would be:

  • document project(s) that bring their own fonts.
  • installable module(s) that bring their own fonts.
  • pandoc templates that bring their own fonts.

Activity

  1. added
    feature request
    on Nov 23, 2024
  2. peng1999 commented on Nov 24, 2024

    @peng1999
    Contributor

    the actual use-cases would be:

    • document project(s) that bring their own fonts.

    Put your OTF files under paths listed in TYPST_FONT_PATHS, and the weight and style info will be recognized by Typst. It should work out of box. Why bother adding new builtin functions?

  3. changed the title [-][Feature Request] allow documents and modules to register artificial or pre-configured font-families[/-] [+]Allow documents and modules to register artificial or pre-configured font-families[/+] on Nov 24, 2024
  4. added
    text
    on Nov 24, 2024
  5. terefang commented on Nov 24, 2024

    @terefang
    Author

    @peng1999 while this is true, stylistic variants are currently (0.12.0) not selectable within families as was already discussed on discord.

    also for artistic purpose one might artificially assemble either a lighter or heavier family variation, as well as an old-style-figures or small caps.

    eg. one where medium is used for normal weight and extra-bold for bold weight.

    yes, i know osf and sc should be typographic features within a font file, but the reality tells us otherwise.

  6. terefang commented on Jan 13, 2025

    @terefang
    Author

    any thoughts on this ?

    from a technical point i do agree with @peng1999 but from an artistical point i have to strongly disagree.

    not everything that can be technically auto-solved may be artistically sound.

  7. laurmaedje commented on Jan 13, 2025

    @laurmaedje
    Member

    I don't have any input right now since I have a lot of things on my plate already at the moment. But we acknowledge that the font handling in Typst leaves stuff to be desired right now and will take this into account when it becomes a focus.

  8. terefang commented on Jan 24, 2025

    @terefang
    Author

    any updates on this ? any estimations when the focus becomes available ?

  9. laurmaedje commented on Jan 24, 2025

    @laurmaedje
    Member

    Please don't repeatedly ask for updates. I can't yet say when I will have time to focus on the font stuff, hence my previous comment.

  10. terefang commented on Jan 24, 2025

    @terefang
    Author

    i dont want to sound rude.

    having no updates might look like the issue was forgotten or ignored.

    other projects do some milestone planning and assignment.

    i would not ping on a regular basis if a workaround would be available but also #2098 seems to be in limbo for now.

  11. laurmaedje commented on Mar 7, 2025

    @laurmaedje
    Member

    I just realized that this is more or less a duplicate of #2469.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requesttext

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions