You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's missing behaviour in public static void MeasureImageSize in CssLayoutEngine.cs which handles px and percentage and just doesn't bother with anything else.
Centimetre and millimetre are spelt incorrectly in the enumeration. This isn't vital but it's conspicuous when you write the missing cases with a switch statement.
Everything assumes 96dpi. Research reveals that CSS requires print devices to scale px to 1/96" which makes this a less crazy decision.
There's no way to get the dpi of the device context to which you're rendering. This is probably why everything assumes 96dpi -- that and print scaling.
Integration of SVG handling was thwarted by the fact that the code depends on ImageFromStream for decoding. This can only handle bitmaps (PNG, JPG etc).
At least in the callback I have direct access to the Graphics object so I can obtain the rendering resolution.
I solved all the absolute scaling problems but didn't handle Em or Ex because it wasn't obvious how to get the font size of the container.
Activity
PeterWone commentedon May 17, 2019
Oh where to begin...
public static void MeasureImageSizein CssLayoutEngine.cs which handles px and percentage and just doesn't bother with anything else.At least in the callback I have direct access to the Graphics object so I can obtain the rendering resolution.
I solved all the absolute scaling problems but didn't handle Em or Ex because it wasn't obvious how to get the font size of the container.
Here's the crux of the fix
Obviously you have to do the same for width.
If I get a chance to sort out font relative units I may offer a PR.