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

add glyph character to the glyph inspector for easier copying #586

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

manylegged
Copy link

Description

Motivation and Context

I'm trying to copy glyphs from an icon font into source code. Displaying the glyph directly in the web page text makes it easy to load up an icon font and copy the characters I need.

How Has This Been Tested?

I copied glyph-inspector.html and opentype.js onto my own server.

Screenshots (if appropriate):

Screenshot 2023-03-08 115810

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I did npm run test and all tests passed green (including code styling checks).
  • I have added tests to cover my changes.
  • My change requires a change to the documentation.
  • I have updated the README accordingly.
  • I have read the CONTRIBUTING document.

Copy link
Contributor

@Connum Connum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comment! Other than that, good addition!
After your changes, please rebase on the current master and request re-review.

@@ -130,6 +130,7 @@ <h1>Free Software</h1>
var glyph = font.glyphs.get(glyphIndex),
html = '<dl>';
html += '<dt>name</dt><dd>'+glyph.name+'</dd>';
html += '<dt>glyph</dt><dd>'+String.fromCodePoint.apply(null, glyph.unicodes) + '</dd>';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When there are multiple code points for a glyph, all characters are just concatenated. A comma separated list would be preferrable. Also "glyph" is not really the correct term as a label here, because it's not the glyph we're showing, but readable characters for codepoints that are matched to that glyph.

@Connum
Copy link
Contributor

Connum commented Oct 19, 2023

Hey @manylegged, I would like to get this merged to reduce the number of open PRs. So if you find the time, it would be great if you had a look at my comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants