charToGlyphIndex() in encoding.js never returns null
See original GitHub issueSo the hasChar() always returns true if this.encoding is an object of CmapEncoding.
// font.js
Font.prototype.hasChar = function(c) {
return this.encoding.charToGlyphIndex(c) !== null;
};
Below code, this.cmap.glyphIndexMap[c.charCodeAt(0)] never returns null. Maybe the caller of charToGlyphIndex() except hasChar() want to receive 0(zero) for using it as index value if there were no mapping glyph.
// encoding.js
CmapEncoding.prototype.charToGlyphIndex = function(c) {
return this.cmap.glyphIndexMap[c.charCodeAt(0)] || 0;
};
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
When JavaScript returns null & undefined? - Stack Overflow
null is used to indicate an unknown or don't care value. undefined on the other hand is designed to indicate that the propery...
Read more >Null vs. Undefined - TypeScript Deep Dive - Gitbook
When JSON-encoding an object with an attribute that is null , the attribute will be included with its null value, whereas an attribute...
Read more >Util | Node.js v19.3.0 Documentation
The util.debuglog() method is used to create a function that conditionally writes debug messages to stderr based on the existence of the NODE_DEBUG...
Read more >Documentation - TypeScript 3.7
Note that if bar is null or undefined , our code will still hit an error ... Unfortunately in TypeScript these checks could...
Read more >Check if a Value Is Null or Undefined in JavaScript or Node.js
Both values, null and undefined , are valuable in JavaScript. ... How to Base64 Encode/Decode a Value in Node.js; Check if a Value...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Are there still plans to implement this fix? This bug caused a lot of confusion until I found out about this issue.
@debussy2k Indeed…! @fpirsch Your solution looks good, should we add this in a next patch or minor version?