I’ m developing a custom form control with the SlimDx library. I’ d like to mesaure some strings, but I have a problem beacuse the string is mesaured as vertical string. This is the code, what’ s the problem?:
float FontSize = 8; string Message = "AAAAA"; SlimDX.DirectWrite.Factory fontFactory = new SlimDX.DirectWrite.Factory(SlimDX.DirectWrite.FactoryType.Shared); SlimDX.DirectWrite.TextFormat fontFormat = fontFactory.CreateTextFormat("Gabriola", SlimDX.DirectWrite.FontWeight.Regular, SlimDX.DirectWrite.FontStyle.Normal, SlimDX.DirectWrite.FontStretch.Normal,FontSize, "it-it"); SlimDX.DirectWrite.TextLayout layout = new SlimDX.DirectWrite.TextLayout(fontFactory, Message, fontFormat); SizeF retValue = new SizeF(layout.Metrics.Width, layout.Metrics.Height);
The result is that height is bigger than width, and if I draw the text with that layout, it is plotted as vertical text.