ITADN

unicode metrics

#349OpenThorin-Oakenpants 创建于 2024-10-07
> 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. ```js 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_
0 条评论