Font family different from preview in exported PDF

Hi,

I use a very simple userstyle.css with my Markdown editor :

@import url('https://fonts.googleapis.com/css2?family=Roboto+Serif:wght@500&display=swap');

body {
	font-family : 'Roboto Serif', sans-serif;
}

@media print {
     body {
	 font-family: 'Roboto Serif', sans-serif;
         font-size: 12px;
         color: #000000;
    }
}

On the preview, the font-family property is OK, as I see the right "roboto" font.

But when exporting in PDF, there is no way to get the right font and the default font is printed. [As a new user here I can't provide embedded screenshots :thinking: ]

What is strange is that the font-size property seems to be effective in the PDF, but not font-family...

I would like my generated PDF to look like the preview. Do you have an idea ?

My version is : 2.6.10, on Windows 10.

Thanks,

Matthieu

@Wameletam welcome to the forum.

As everything after @media print { is the stylesheet for printing would you need to import the font there as well?

1 Like
@import url('https://fonts.googleapis.com/css2?family=Roboto+Serif:wght@500&display=swap');

body {
	font-family : 'Roboto Serif', sans-serif;
}

@media print {
     @import url('https://fonts.googleapis.com/css2?family=Roboto+Serif:wght@500&display=swap');
     body {
	 font-family: 'Roboto Serif', sans-serif;
         font-size: 12px;
         color: #000000;
    }
}

With this stylesheet I have the same result than before.
(Of course I tried to modify my current file, and to quit completely Joplin, then re-exporting...)

Hi,

The problem was in the internet access of the "import" while exporting.
It seems the exporting tool didnt manage to get that access : I solved the problem by replacing the "import" by the google-font stylesheet I wanted to include :

/* vietnamese */
@font-face {
  font-family: 'Roboto Serif';
  font-style: normal;
  font-weight: 500;
  font-stretch: normal;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/robotoserif/v5/R71RjywflP6FLr3gZx7K8UyuXDs9zVwDmXCb8lxYgmuii32UGoVldX6UgfjL4-3sMM_kB_qXSEXTJQCFLH5-_bcElhgtl698AM5f.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Roboto Serif';
  font-style: normal;
  font-weight: 500;
  font-stretch: normal;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/robotoserif/v5/R71RjywflP6FLr3gZx7K8UyuXDs9zVwDmXCb8lxYgmuii32UGoVldX6UgfjL4-3sMM_kB_qXSEXTJQCFLH5-_bcElhgtl658AM5f.woff2) format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Roboto Serif';
  font-style: normal;
  font-weight: 500;
  font-stretch: normal;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/robotoserif/v5/R71RjywflP6FLr3gZx7K8UyuXDs9zVwDmXCb8lxYgmuii32UGoVldX6UgfjL4-3sMM_kB_qXSEXTJQCFLH5-_bcElhgtl6B8AA.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

body {
	font-family : 'Roboto Serif', sans-serif;
}

@media print {
     body {
	 font-family: 'Roboto Serif', sans-serif;
         font-size: 12px;
         color: #000000;
    }
}

Also, it didn't require to import again in the @ media orint block.

Thanks !

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.