Hi @wdh_it
"For interop purposes though, ISO 29500 specifies only the final resulting ‘ht’ value is written. So there’s no expectation or requirement that all file produces create files with the same values." Hence, algorithm will not be described in Microsoft Open Specifications.
Applications can render in a way that is visually appealing or meets the requirements of their application. This does not include mimicking the design choices of another application. Rendering is left for the consuming application as a choice and not prescribed by the standard.”
Following are some resources that should help you get started
.net function called system.drawing.graphics.measurestring https://video2.skills-academy.com/en-us/dotnet/api/system.drawing.graphics.measurestring?view=dotnet-plat-ext-5.0
public static Point GetTextSize(Graphics graphics, Font graphicsFont, String text, Int32 width, StringFormat format)
{
Point textSize;
SizeF tempSizeF;
tempSizeF = graphics.MeasureString(text, graphicsFont, width, format);
textSize = new Point();
textSize.X = (int) tempSizeF.Width;
textSize.Y = (int) tempSizeF.Height;
return textSize;
}
Source - https://csharp.hotexamples.com/examples/-/Graphics/MeasureString/php-graphics-measurestring-method-examples.html
For Font Metrics, please refer to How to: Obtain Font Metrics https://video2.skills-academy.com/en-us/dotnet/desktop/winforms/advanced/how-to-obtain-font-metrics?view=netframeworkdesktop-4.8.
DirectWrite (DWrite) https://video2.skills-academy.com/en-us/windows/win32/directwrite/direct-write-portal
DWriteCore overview https://video2.skills-academy.com/en-us/windows/win32/directwrite/dwritecore-overview
As @Castorix31 mentioned, you can find the formula in old KB74299 : INFO: Calculating The Logical Height and Point Size of a Font
(hdc is the Device Context handle where the font has been selected with SelectObject)
HungChun Yu
Microsoft Open Specifications