Automattic / Automattic/node-canvas

font-variant, small-caps support in pango and fake small-caps

Open
#894 4 comments 1 reaction 0 assignees View on GitHub
Feature Text & Fonts
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

My recently merged pull request #891 fixed the issue with correctly parsing the font style. The `font-variant` was ignored, and caused the font not to be correctly parsed.

I tried to also pass the variant to `pango`, but it seems that it is being ignored. Most fonts don't support small-caps (which is the only variant besides `normal` that is available in `pango`), and it seems to me that `pango` might not support it when it's there.

Here is my failed attempt to pass the `font-variant` to pango: https://github.com/yever/node-canvas/commit/f002e1af22d7f03a94a70b5999d98d784f9a0cc0

I played with `pangocairo` on python with similar results. I couldn't find any font that would show any different when the font variant is set to VARIANT_SMALL_CAPS.

Font rendering on the web uses mostly fake small caps. I think that the general approach is to replace the lowercase characters with uppercase ones and scale them down to 70%. Do we want this also in `node-canvas` to imitate the browser's behavior? This will not be provided by `pango` and should be implemented separately.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.