Code Monkey home page Code Monkey logo

Comments (4)

samwilson avatar samwilson commented on August 23, 2024

I did some work on fixing this with the addition of a config_fonts.php file in your dw2pdf template. The format of it is describe on the mPDF site; for example:

<?php
$fontdata = array(
    'gillsans' => array(
        'R'  => 'GIL_____.ttf',
        'B'  => 'GILB____.ttf',
        'I'  => 'GILI____.ttf',
        'BI' => 'GILBI___.ttf',
    ),
);

You also need to define _MPDF_SYSTEM_TTFONTS in conf/local.protected.php to be the path of your font directory.

from dokuwiki-plugin-dw2pdf.

begntsly avatar begntsly commented on August 23, 2024

Thank you samwilson.
I exchanged action.php by yours and set up _MPDF_SYSTEM_TTFONTS in mpdf/config_fonts.php - indeed I cannot find any file named local_protected.php in conf/ (and anywhere else...) in my install (latest DW2PDF version in DWplugin)!?
But it still doesn't work, fonts embed in the pdf are only DejaVu... and don't support any CJK (all Japanese rendered as squares). I tried again to setup config_fonts.php by enabling CJK array fonts, installed Sun-ExtA & B ttf in mpdf/ttfonts... without any success.
Could you help me out for the settings to apply?

I've also tried another version of DW2PDF, the fork by Michitux, which is rendering well (using WenQuanYiZenHei font) for the first 381 characters, then squares reappeared, see here https://forum.dokuwiki.org/thread/9819

Any other idea?
Thanks

from dokuwiki-plugin-dw2pdf.

samwilson avatar samwilson commented on August 23, 2024

I'm sorry it's not working. :(

You need to create conf/local.protected.php if it doesn't exist, and in it put:

define('_MPDF_SYSTEM_TTFONTS', '/path/to/your/fonts/directory');

If the example I have above, the files GIL_____.ttf, GILB____.ttf, etc. are in that directory. You should change these in the config_fonts.php file (in your dw2pdf template directory) for whatever your font files are called (for Regular, Bold, Italic, and Bold Italic).

from dokuwiki-plugin-dw2pdf.

begntsly avatar begntsly commented on August 23, 2024

Ok thanks,
I've made all of these changes and tried lot of fonts but even it's not working for me (I was just able to force a font set - sun-exta & b - by adding them on the array at $this->sans_fonts at the end of config_fonts.php, but the result was a bit ugly. Indeed sun-exta & b fonts were also used for latin text).
Finally I've used the fork by Michitux and changed the setting of useAdobeCJK (true instead of false) in mpdf/config.php
Thanks for your help

from dokuwiki-plugin-dw2pdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.