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

Update generator for Unicode 12.1 #426

Merged
merged 7 commits into from
Feb 3, 2020
Merged

Update generator for Unicode 12.1 #426

merged 7 commits into from
Feb 3, 2020

Conversation

rubengees
Copy link
Collaborator

@rubengees rubengees commented Feb 2, 2020

This PR is a bigger overhaul of the generator to support the latest changes to our data source among other things:

  • Update to latest emojis and make necessary changes to the generator.
  • Add google compat to the targets (only code generated).
  • Fix low(er) quality images.
  • Add facebook module.
  • Update dependencies.

This comes with a significant change how we generate the categories. Due to too many icons being present now we started to run into "code too large" exceptions. I have changed the generator so that it generates "chunk" classes of 250 emojis at most and concats them together in the actual category.

Before:

category
-- PeopleCategory
-- SymbolsCategory
-- TravelCategory

Now:

category
-- SmileysAndPeopleCategory
-- SmileysAndPeopleCategoryChunk0
-- SmileysAndPeopleCategoryChunk1
-- SymbolsCategory
-- SymbolsCategoryChunk0
-- TravelAndPlacesCategory
-- TravelAndPlacesCategoryChunk0
-- CategoryUtils

As always this PR comes without the generated code to make review easier.
Would close #344 and #356.

This comes with some significant changes since the generated code as the
structure was before could not be compiled. We now chunk the emojis into
configurable lists which each get a class in the style of
ActivitiesCategoryChunk0. Also, the categories have changed a bit, so these
get now normalized to what we had before. Finally this fixes a bug causing
low(er) image quality.
@rubengees rubengees requested review from mario and vanniktech February 2, 2020 16:30
const maxY = emojiByStrip[i].map(it => it.sheet_y).reduce((a, b) => Math.max(a, b), 0);
const height = (maxY + 1) * 66;
const strip = await new Jimp(66, height);
await strip.blit(sheet, 0, 0, i * 66, 0, 66, height);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was the cause of lower quality images.

const maxY = emojiByStrip[i].map(it => it.sheet_y).reduce((a, b) => Math.max(a, b), 0);
const height = (maxY + 1) * 66;

const strip = await sheet.clone().crop(i * 66, 0, 66, height)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We now simply crop.


result.set("SmileysAndPeople", smileysAndEmotion.concat(peopleAndBody))
result.delete("SmileysAndEmotion")
result.delete("PeopleAndBody")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Our upstream source slightly changed the categories. Here we normalize them back to what we had previously.


await fs.writeFile(`${dir}/${target.name}.java`, _(emojiTemplate).template()({
await fs.writeFile(`${valuesDir}/strings.xml`, template(stringsTemplate)({
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We now also generate the strings.xml file automatically.

vanniktech
vanniktech previously approved these changes Feb 3, 2020
Copy link
Owner

@vanniktech vanniktech left a comment

Choose a reason for hiding this comment

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

Looks good

@rubengees
Copy link
Collaborator Author

I have added the generated files and will merge once CI passes and @mario approves 🙂.

@mario
Copy link
Collaborator

mario commented Feb 3, 2020

Approved by Mario (tm)

@rubengees rubengees merged commit 8c2adc4 into master Feb 3, 2020
@vanniktech vanniktech deleted the unicode12 branch February 4, 2020 13:56
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.

Add facebook and whatsapp emojis
3 participants