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

Typst brand yaml: typography bells and whistles #10974

Merged
merged 9 commits into from
Oct 7, 2024

Conversation

gordonwoodhull
Copy link
Contributor

@gordonwoodhull gordonwoodhull commented Oct 4, 2024

This is in good shape and has basic test coverage for all supported feature-element combinations.

image

Also includes support for subtitles in typst, taking @mcanouil's contribution to the Pandoc template from upstream #9638, and styling it as a heading.

Leaving this as a draft for now because although I'd be happy merging this in its current state, there are a few last touches to make:

  • Remove less-useful feature-element combinations
image
  • Typst brand.typography should allow use of named colors from brand.color for color, background-color
  • Support rem correctly when brand.typography.base.size is specified. Current blind change to em will be the fallback with a warning when base.size is unknown
  • Translation of CSS padding and width for logo - currently one must use Typst-compatible units.
  • Refactor CSS->Typst translation functions to a module used by typst brand yaml and typst css

@gordonwoodhull gordonwoodhull force-pushed the feature/typst-brand-yaml-bells-and-whistles branch from eeafabf to 094ebe2 Compare October 5, 2024 14:44
weight
style
size
decoration
color
background-color
line-height
there are no abstractions here
each element has different properties supported
@gordonwoodhull gordonwoodhull force-pushed the feature/typst-brand-yaml-bells-and-whistles branch from 094ebe2 to 6cb26c3 Compare October 5, 2024 14:46
@gordonwoodhull gordonwoodhull marked this pull request as ready for review October 5, 2024 14:46
@gordonwoodhull gordonwoodhull force-pushed the feature/typst-brand-yaml-bells-and-whistles branch from 5a7055f to 26b8a1e Compare October 5, 2024 17:19
@gordonwoodhull
Copy link
Contributor Author

gordonwoodhull commented Oct 5, 2024

Hmm, perhaps I should not use ensurePdfRegexMatches / pdftotext so much.

It is helpful for testing that the font caching pipeline is working, because I can

#set text(fallback: false)

and Typst won’t output text in fonts it doesn’t have.

But pdftotext (and pdf extraction in general IIUC) is somewhat non deterministic in how strings are broken into words and lines (or rather, how it regroups the letters).

So I’ve got one falling test which I give up on for today. But otherwise this is ready.

rename typst_css_to_props typst_css_property_processing
@gordonwoodhull gordonwoodhull force-pushed the feature/typst-brand-yaml-bells-and-whistles branch from cea828e to e071aa8 Compare October 7, 2024 08:05
basis case for translating base.size: 1rem

to avoid infinite recursion

expose parse_length and use for base.size
broaden test for inconsident spaces in pdftotext

pdftotext provides inherently inconsistent output
with spaces and even ordering varying by platform

it should probably not be used with such long strings
(and this isn't necessary because the properties are
 tested in ensureTypstFileRegexMatches)
@gordonwoodhull gordonwoodhull force-pushed the feature/typst-brand-yaml-bells-and-whistles branch from e071aa8 to 29aca72 Compare October 7, 2024 08:24
@gordonwoodhull gordonwoodhull merged commit 4fb474c into main Oct 7, 2024
47 checks passed
@gordonwoodhull gordonwoodhull deleted the feature/typst-brand-yaml-bells-and-whistles branch October 7, 2024 08:46
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gordonwoodhull do we want to keep the PDF committed ?
Is this to have an example of default template ?

Just wondering, it case it was for testing initially

Copy link
Contributor Author

@gordonwoodhull gordonwoodhull Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cderv!

Nope, it looks like this artifact is generated when the .typ is edited in vscode. (Seems to happen with any valid .typ file.) There is no reason to compile a template on its own, never mind check it in.

I've removed it.

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

Successfully merging this pull request may close these issues.

2 participants