Fix CJK fonts again and misc. font issues (#14575)
* Push system-ui further down the stack, fix #12966 * Fix Firefox showing U+300x in emoji font and more * Revert emoji font and fix long-standing Safari bug * Exclude Safari emoji fix above 1.25x zoom * Minor correctness/typo fix, affects only legacy platforms * Emoji consistency for monospace (e.g. EasyMDE) * Override paradigm; macOS/iOS-specific metric fix * Move whitespace fix to font-face * Handle metric calculation errors with Firefox * One last workaround for aliased fonts in Linux
This commit is contained in:
parent
c0c052bdbb
commit
0e5c6c4498
6 changed files with 187 additions and 40 deletions
|
@ -28,3 +28,16 @@ export function uniq(arr) {
|
|||
export function stripTags(text) {
|
||||
return text.replace(/<[^>]*>?/gm, '');
|
||||
}
|
||||
|
||||
// searches the inclusive range [minValue, maxValue].
|
||||
// credits: https://matthiasott.com/notes/write-your-media-queries-in-pixels-not-ems
|
||||
export function mqBinarySearch(feature, minValue, maxValue, step, unit) {
|
||||
if (maxValue - minValue < step) {
|
||||
return minValue;
|
||||
}
|
||||
const mid = Math.ceil((minValue + maxValue) / 2 / step) * step;
|
||||
if (matchMedia(`screen and (min-${feature}:${mid}${unit})`).matches) {
|
||||
return mqBinarySearch(feature, mid, maxValue, step, unit); // feature is >= mid
|
||||
}
|
||||
return mqBinarySearch(feature, minValue, mid - step, step, unit); // feature is < mid
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue