Replies: 1 comment 2 replies
-
Hi @takev, thanks for trying the library! 😃 Generally, it is easier for us to discuss such use cases if you could share a Compiler Explorer link with us. With that we can better understand your use case and propose some solutions as well. Said that, I am not sure if pixels should be an
Thanks to that, if you divide
We also have an old and simple prototype of the typographic system that could be extended with your use cases. @JohelEGP has more experience in GUIs library, so maybe he can provide more guidance here as well. |
Beta Was this translation helpful? Give feedback.
-
I am trying to use mp-units in a GUI library, I need a few more units that I am trying to design, but I am bit stuck.
I added a new type
pixel
which is a length. Then I added appi
(pixels per inch) type as:pixel / international::inch
. This was easy, works perfectly, if my CSS file has a size in SI or international units, I can multiply it withppi
to get the size in pixels.Now the next one is the one I get confused by: The CSS file may also list a length in em-quad this a length in multiples of the font-size (also read from the CSS file).
The font-size is normally described in SI/international units, like 12pt. So if I want to convert a quantity in em-quad to international units I need to multiply em-quad with the font-size, but that can only work if em-quad is a unitless quantity, but it is still a length at the same time.
We could also describe font-size as:
international::point / em-quad
. This would be weird, because font-sizes are normally described only in points.Is there something in mp-units to solve this?
Beta Was this translation helpful? Give feedback.
All reactions