PDConSec / vsc-print

Completely local print support for VS Code with syntax-colouring and line numbering
Other
67 stars 27 forks source link

Print Typeface not rendering #305

Open Kush-4826 opened 2 months ago

Kush-4826 commented 2 months ago

The Type face that is selected in the VS Code is not applied to the prints. The prints appear in the browser default Serif font.

This is the Default Font Family Setting in the IDE image

This is What the code looks like in the IDE image

And this is what the Print looks like image

ChaganKhagan commented 2 months ago

Similar problem here, only I set my custom typeface in the VS Code but what's printed is the default Menlo. Suppose this problem is either related to Non-System typefaces or when the fonts have format of .otf

PeterWone commented 2 months ago

Sorry to keep you both waiting, we have some build problems blocking release so the backlog has been building. First I'll get the build going, then the low hanging fruit, then I'll put some time into this one.

PeterWone commented 1 month ago

While I'm getting to this, would you please

  1. Tell me what platform you're using (Win/Linux/MacOS).
  2. Tell me what browser you're using (a Chromium derivative, Firefox, Safari or something else)
  3. Disable Print and Close in your settings so the browser print dialog doesn't open when the print job is sent to the browser then trigger the problem and inspect the page to tell me what font-family is being specified for the incorrectly formatted text

If you can determine which CSS class is actually contributing the value in use, that would be super handy.

ChaganKhagan commented 1 month ago

Hi Peter!

Thanks for reaching to me.

I have been doing some very tiny experiments myself and this is what I have discovered. Hopefully it will be of any help.

First I’ll answer your questions.

  1. I am using macOS 14 (Sonoma)
  2. I am using Safari
  3. This is the font settings I applied on my VS Code: 
  4. This is the snapshot of the source code I took from Safari: 

I have confirmed that all four lines (font-family, font-size, line-height and padding bottom) are manually adjustable in situ and the changes will take effect realtime.

If I change the default font-family to another ’System' Font, say ‘Comic Sans MS', the rendering will change as well. But if I change the default font-family to a non-system Font (those I installed later), the rending will not change at all, regardless of the font format.

Hopefully my findings could be of any help.

Coding Wishes, Sylvester

Peter Wone @.***> 於 2024年5月9日 09:11 寫道:

While I'm getting to this, would you please

Tell me what platform you're using (Win/Linux/MacOS). Tell me what browser you're using (a Chromium derivative, Firefox, Safari or something else) Disable Print and Close in your settings so the browser print dialog doesn't open when the print job is sent to the browser Inspect the page and see what font-family is being applied to the source text If you can determine where the value came from via CSS that would be super handy.

— Reply to this email directly, view it on GitHub https://github.com/PDConSec/vsc-print/issues/305#issuecomment-2101746871, or unsubscribe https://github.com/notifications/unsubscribe-auth/BAHWIPZ2674G2CJJFXUHUQ3ZBLENVAVCNFSM6AAAAABGZ4EAAWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBRG42DMOBXGE. You are receiving this because you commented.

PeterWone commented 1 month ago

Similar problem here, only I set my custom typeface in the VS Code but what's printed is the default Menlo. Suppose this problem is either related to Non-System typefaces or when the fonts have format of .otf

It is almost a certainty that this or something similar is the problem. The browser must be able to resolve the typeface from the name. This hasn't been an issue for symbolic names like serif or monospace and on Windows where most people use it, the typeface name reported by VSCode settings has been correctly resolved by all common browsers, but this issue suggests this does not hold for MacOS.

I do have a Mac for the specific purpose of debugging this kind of problem so I'll set it up and experiment with different fonts. It may be necessary to invent some kind of setting for mapping names if there isn't a single mapping function.

If you're interested in investigating this then you could save the page and supporting resources to a folder (I assume this is possible with Safari, certainly Chrome derivatives can do it). Then you can tinker with the font-family in the CSS until you figure out what to do to the name to get it to resolve.