Skip to content

unicode metrics #150

@Thorin-Oakenpants

Description

@Thorin-Oakenpants

is it possible to make the font sizes in the the unicode glyphs test, zoom resistant?

This has been on my mind. There is a method I use to harden unicode metrics (emojis & glyphs). Instead of using the text pixel sizes as the metric, I look for the first occurrences of unique dimensions and then the final set is the metric. I also reduce the dimensions in the set to a sum. Then, if we change the screen device pixel ratio or font size, this unique set (but not the sum) should remain the same.

const unicodeSet = new Set()

// loop through the results... and then add new metrics to the set
const metricAsString = "200 x 300"// example
if (!unicodeSet.has(metricAsString)) {
  unicodeSet.add(metricAsString)
}

const uniqueList = [...unicodeSet] // cast set to array
const sum = uniqueList.reduce((acc, x) => acc += x.split(' x ').reduce((acc, x) => acc += Number(x), 0), 0)

Originally posted by @abrahamjuliot in https://github.com/arkenfox/TZP/issues/49#issuecomment-1024618900

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions