Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed font with better UTF-8 Support #10

Closed
acrosman opened this issue Oct 14, 2018 · 2 comments
Closed

Embed font with better UTF-8 Support #10

acrosman opened this issue Oct 14, 2018 · 2 comments
Labels
enhancement New feature or request Hacktoberfest

Comments

@acrosman
Copy link
Owner

The black and white versions of the patter need to support using distinct symbols when possible to replace colors in the pattern. Right now the generator using a series of UTF-8 multibyte characters from selected ranges. But the default fonts in PDF from PdfKit don't support these (see foliojs/pdfkit#262). So a different font that does have those characters needs to be embedded.

@acrosman acrosman added Hacktoberfest enhancement New feature or request labels Oct 14, 2018
@acrosman acrosman self-assigned this Oct 14, 2018
acrosman added a commit that referenced this issue Oct 14, 2018
The color index now regenerates for each pattern, and selections are made from more common code points. There are still some that are not in Roboto getting selected so more narrowing of the list is required.  Addresses by #10 and #11.
@acrosman
Copy link
Owner Author

acrosman commented Oct 14, 2018

Roboto helped some, but mostly things improved by moving to a much smaller range of characters. The list of symbols is still too large for Roboto. More work could be done to comment out ranges that are outside Roboto's character set, find a font with more support for non-European languages, and ideally add character ranges that add more options while being unlikely to lead to user confusion (people unexperienced with the languages need to be able to tell the difference between the symbols easily).

Existing ranges:

const symbolRanges = [
{ start: 0x003C, stop: 0x005C }, // Capital letters and a few marks.
{ start: 0x00A1, stop: 0x00B7 }, // Standard signs and symbols.
{ start: 0x03A8, stop: 0x03EE }, // Greek letters.
{ start: 0x0531, stop: 0x0556 }, // Armenian letters.
// TODO: find an font that includes these marks and revisit if they could be used.
// { start: 0x2600, stop: 0x26AF }, // Miscellanious Symbols.
// { start: 0x2200, stop: 0x22FF }, // Math Operators.
// { start: 0x2B00, stop: 0x2B2F }, // Miscellanious Symbols and arrows.
];
// Some symbols are too similar to others, or are political in nature and so are
// removed to avoid frustrtion of confusion.
const skipSymbols = [
String.fromCodePoint(0x00AD), String.fromCodePoint(0x03D3),
String.fromCodePoint(0x03D4), String.fromCodePoint(0x03D9),
String.fromCodePoint(0x03DB), String.fromCodePoint(0x03DD),
String.fromCodePoint(0x03DF), String.fromCodePoint(0x03E0),
String.fromCodePoint(0x03E3), String.fromCodePoint(0x03E4),
String.fromCodePoint(0x03E9), String.fromCodePoint(0x03E8),
String.fromCodePoint(0x03EB), String.fromCodePoint(0x03EC),
// TODO: When the rest of the code points above are restored, restore these as well.
// String.fromCodePoint(0x2620), String.fromCodePoint(0x262D),
// String.fromCodePoint(0x2673), String.fromCodePoint(0x2674),
// String.fromCodePoint(0x2675), String.fromCodePoint(0x2676),
// String.fromCodePoint(0x2677), String.fromCodePoint(0x2678),
// String.fromCodePoint(0x2679), String.fromCodePoint(0x267C),
// String.fromCodePoint(0x269D), String.fromCodePoint(0x269E),
// String.fromCodePoint(0x269F),
];

@acrosman
Copy link
Owner Author

Replaced Roboto with DejaVu which has support for all characters in the current space and several others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Hacktoberfest
Projects
None yet
Development

No branches or pull requests

1 participant