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 glyphName, htmlCode, cssCode to glyph inspector. #662

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

Conversation

ahaoboy
Copy link

@ahaoboy ahaoboy commented Dec 21, 2023

Description

Referencing the site website, adding glyphName, glyph, htmlCode, cssCode to the glyph inspector for easy copying. Due to no response on #586, I separately submitted this PR.

For cases involving multiple unicode, the use of String.fromCodePoint.apply also works.

var str = '\uD83D\uDC04';
console.log(str)

var str2 =  String.fromCodePoint.apply(null, [55357, 56324])
console.log(str2)

Motivation and Context

For easier copying of unicode characters

How Has This Been Tested?

Local testing ensures proper functionality when copying and pasting into HTML and CSS.

Screenshots (if appropriate):

image

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.

Why go the route loading the font via CSS instead of getting the data directly from the Font object? This also has the same issue as #586

@ahaoboy
Copy link
Author

ahaoboy commented Dec 27, 2023

Why go the route loading the font via CSS instead of getting the data directly from the Font object? This also has the same issue as #586

I'm not familiar with the font API, so I referred to #586. I also couldn't find a way to directly obtain the corresponding string from glyphs. If there's a better solution, please guidance me. Additionally, how should we add the string corresponding to the glyphs to their attributes?

image

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.

2 participants