question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Emojis in URL fragment breaks navigation

See original GitHub issue

Haveing the following Slide in my Presentation in RevealJS;

<section>
        <h1>Disclaimer</h1>
        <p class="fragment current-only">Cuztomized with ❤️</p>
</section>

Does not work and outputs the error:

Loading page http://localhost:3000 ...
Loading page finished with status: 200
Reveal JS plugin activated
Printing slide #/5      (6/6) ...not support cmap format:14

URIError: URI malformed

removing the emoji, everything works.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
JPtenBergecommented, Sep 16, 2019

I’ve tried to pin down what’s causing the error. It doesn’t seem to be Puppeteer. It’s this line that causes the error:

const font = Font.create(buffer, { type: 'ttf', hinting: true });

To give a bit of context, here is a bit more code. It’s from decktape.js, starting at line 405.

// Consolidate duplicate fonts
function parseFont(fontObject) {
	const pdfStreamInput = cpyCxtParser.parseNewObject(fontObject.getObjectID());
	const fontDictionary = pdfStreamInput.toJSObject();
	
	// See "Introduction to Font Data Structures" from PDF specification
	if (fontDictionary.Subtype.value === 'Type0') {
	// TODO: properly support composite fonts with multiple descendants
	const descendant = cpyCxtParser
		    .parseNewObject(fontDictionary.DescendantFonts.toJSArray()[0].getObjectID())
		    .toJSObject();
	if (descendant.Subtype.value == 'CIDFontType2') {
		const descriptor = cpyCxtParser
		    .parseNewObject(descendant.FontDescriptor.getObjectID())
		    .toJSObject();
		const id = descriptor.FontFile2.getObjectID();
		const buffer = readStream(cpyCxtParser.parseNewObject(id));
		const font = Font.create(buffer, { type: 'ttf', hinting: true });

It’s this last line that gives the not support cmap format:14 error. I checked what’s in the font dictionary as well:

{
	BaseFont: PDFName { value: 'SegoeUIEmoji' },
	DescendantFonts: PDFArray {},
	Encoding: PDFName { value: 'Identity-H' },
	Subtype: PDFName { value: 'Type0' },
	ToUnicode: PDFIndirectObjectReference {},
	Type: PDFName { value: 'Font' }
}

Does the fonteditor-core library have trouble working with SegoeUIEmoji and is that why @gabyx solution with the EmojiOne font works? It’s all still a bit vague to me to be honest. I’m hoping someone (@astefanutti?) can shed some more light on this. Are there alternatives to fonteditor-core we might be able to use?

1reaction
astefanutticommented, Sep 17, 2019

Thanks a lot for the input. I’m not entirely sure the not support cmap format:14 message is the cause of the URIError: URI malformed. I need to dig into it.

fonteditor-core was the most robust font parsing OSS library I could find a couple of years ago. It is possible to switch to another library if one exists that’s more robust.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Emoji in header breaks generated link · Issue #36 - GitHub
I tried modifying the URL fragment on one of your broken links and it worked.
Read more >
Animating URLs with Javascript and Emojis - Matthew Rayfield
You can use emoji (and other graphical unicode characters) in URLs. And wow is it great. But no one seems to do it....
Read more >
html - In Markdown, what is the best way to link to a fragment ...
See this answer. In summary make a destination with <a name="sometext"></a>. inserted anywhere in your markdown markup (for example in a ...
Read more >
target - CSS: Cascading Style Sheets - MDN Web Docs
The :target CSS pseudo-class represents a unique element (the target element) with an id matching the URL's fragment.
Read more >
Chromium Docs - Guidelines for URL Display
Guidelines for URL Display. This document covers the best practices and pitfalls for building UI to display URLs in browsers and other apps....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found