• Resolved Ozcarr

    (@ozcarr)


    The common Chinese Character “鰂” (meaning quarry and a type of fish) is showing well in woocommerce, but not on pdf of invoice. I’m currently using fireflysung-1.3.0.ttf. I’ve tried many other Chinese True Type character sets ( eg NotoSans-CondensedMedium.ttf, cwTeXQFangsong-Medium.ttf, hanwangmingmediumpoin1’s wp110-05.ttf, …) but most even have more characters showing as tofu.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    Hello @ozcarr

    Can you show me how are you loading the font?

    Let me know.

    Thread Starter Ozcarr

    (@ozcarr)

    /* Main Body */
    @page {margin-top: 1cm;margin-bottom: 3cm;margin-left: 2cm;margin-right: 2cm;}
    body {
    background: #fff;
    color: #000;
    margin: 0cm;
    font-family: ‘fireflysung’, ‘Open Sans’, sans-serif;
    font-size: 12pt;
    line-height: 100%; /* fixes inherit dompdf bug */
    }
    @font-face {
    font-family: ‘fireflysung’;
    font-style: normal;
    font-weight: normal;
    src: local(‘fireflysung’), local(‘fireflysung’), url(<?php echo $this->get_template_path(); ?>/fonts/fireflysung.ttf) format(‘truetype’);
    }
    h1, h2, h3, h4 {
    font-weight: bold;
    margin: 0;
    }

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    This is the top of my style.css. Does this help ?

    • This reply was modified 4 years, 4 months ago by Ozcarr.
    • This reply was modified 4 years, 4 months ago by Ozcarr.
    Plugin Contributor alexmigf

    (@alexmigf)

    Hello @ozcarr

    Can you try to load the font with @font-face before the body tag? Like this:

    @page {
    	margin-top: 1cm;
    	margin-bottom: 3cm;
    	margin-left: 2cm;
    	margin-right: 2cm;
    }
    @font-face {
    	font-family: ‘fireflysung’;
    	font-style: normal;
    	font-weight: normal;
    	src: local(‘fireflysung’), local(‘fireflysung’), url(<?php echo $this->get_template_path(); ?>/fonts/fireflysung.ttf) format(‘truetype’);
    }
    body {
    	background: #fff;
    	color: #000;
    	margin: 0cm;
    	font-family: ‘fireflysung’, ‘Open Sans’, sans-serif;
    	font-size: 12pt;
    	line-height: 100%; /* fixes inherit dompdf bug */
    }
    h1, h2, h3, h4 {
    	font-weight: bold;
    	margin: 0;
    }

    Append &output=html to the PDF url and check with the browser developer tools if the font is being loaded correctly.

    Thread Starter Ozcarr

    (@ozcarr)

    Hi Alex,
    Did what you asked.

    With the &output=html the 鰂 is rendered well on screen, as it does in WooCommerce. But not in the PDF, even after a hard refresh and using another browser.

    However, when I copy paste the tofu block into a text editor it shows correctly!

    ( I”m using the newest WP version 5.4.2–zh_HK, updated plugins on linux PCs. )

    Plugin Contributor alexmigf

    (@alexmigf)

    Hello @ozcarr

    Can you please contact us by email to: [email protected]

    We will do our best to help you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Can’t generate Chinese Character “鰂”’ is closed to new replies.