Metrica Typus -- Capsizing + Trim + REMsizing in CSS only ... for Tailwind #180
Replies: 2 comments
-
Hey @andriytyurnikov thanks for sharing. Be interested to see where the solutions differ. The issue with relative font size from memory has been that the trims depend on knowing the font size and line height. We did prototype moving the implementation into css vars but the calcs were quite heavy. Definitely interested to compare notes here. |
Beta Was this translation helpful? Give feedback.
-
@michaeltaranto sure thing - nothing new, just reshuffling computations: Most questionable part is that I am using shortest branch of your formula, by having lineGap = 0;
With this parts being memoized at build-time, we are left with 6-7 arithmetic operations for each part of the trim. 12 arithmetic opertions total for both sides of the trim. 3.3) Tailwind plugin architecture allows exactly that - constructing CSS classes (postcss) on the fly from their names - performing computations, and generating CSS with valiables in it. So yes - browser is pushed close to it's limits. And only part of computations are performed at build time. What helps to visualize this approach is writing down required computation results into single formula - in this way it is easier to see which parts of the formula may be memoized at build time. Once again - I really could use expanded comment on role of lineGap, as so far seems unnecessary |
Beta Was this translation helpful? Give feedback.
-
Meet beta version of Metrica Typus - size your capital letters in REMs, including fractional values, trim, TailwindCSS ecosystem. Injection of CSS custom properties (generated from font metrics) and
calc()
is used to keep solution in CSS space.If interested - check it out - feedback is needed.
Beta Was this translation helpful? Give feedback.
All reactions