Skip to content

Conversation

@happyDemon
Copy link

I thought it would be a good addition to the package to support font conversion.

The code is based on what dompdf ships in loadfont.php

font:convert
    {fontFamily : the name of the fonts, e.g. Verdana, \'Times New Roman\', monospace, sans-serif. If it equals to "system_fonts", all the system fonts will be installed.}
    {fileName : the .ttf or .otf file for the normal, non-bold, non-italic face of the fonts.}
    {--b|bold= : Bold fonts face specific file}
    {--i|italic= : Italic fonts face specific file}
    {--bi|bold-italic=} : Bold italic fonts face specific file

allow for config cache to be exported
update readme
@happyDemon happyDemon mentioned this pull request Oct 10, 2021
@oneWaveAdrian
Copy link

@happyDemon woah nice job!
@barryvdh this looks very useful, do you have time to approve&merge?

@oneWaveAdrian
Copy link

Thanks @jadamec for taking a look so swiftly!

@tyler36
Copy link

tyler36 commented Nov 29, 2021

I spent the last few hours trying to get Japanese fonts working. I was about to give up when I tried this.

Great job @happyDemon!

@iwandepe
Copy link

Why is this pull request still not merged until now?

@iwandepe
Copy link

Hy @happyDemon, i've used your command and it works smoothly. But I found that the command cannot work to generate multiple fonts. It will replace font that generated in the beginning at dompdf_font_family_cache.php

*/
public function handle()
{
$dompdf = new Dompdf();

Choose a reason for hiding this comment

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

The Dompdf instance must be taken from the service container.

  1. Then you won't need to manually set the option for font_dir. The service container itself will set all options from config('dompdf.defines');
  2. And in such a case, the FontMetrics class will be initialized with the fontDir option in mind. And then the fonts will not be overwritten, as described here Add command to convert fonts #820 (comment)

@barryvdh
Copy link
Owner

barryvdh commented Oct 2, 2023

Is this required? Isn't this done by dompdf itself on the fly?

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.

7 participants