Font edit control (RepositoryItemFontEdit) don't draw "Cambria Math" font in drop down menu. See in attachment.
Steps to Reproduce:
- Create Windows Application
- Add BarManager
- Add Font Edit control
- Run application
- "Cambria Math" font don't draw in drop down menu
Hello Mikhail,
We use the Graphics.DrawString method to draw font samples. Can you please check whether the DrawString method works for your font? Another possible cause of this problem is that the Cambria Math font has large characters, so that they don't fit combo box' rows. You can set a bigger font to your FontEdit control to check this:
this.fontEdit1.Properties.AppearanceDropDown.Font = new System.Drawing.Font("Tahoma", 14.25F);
Please keep us informed of your results.
Thanks,
Nick
I investigate this issue, and found the code to draw fonts in this drop down (FontItemPaintHelper.DrawFontName):
private static void DrawFontName(Graphics gr, string name, Font font, Font normalFont, Brush brush, Rectangle bounds, bool showPreview)
{
using (StringFormat format = new StringFormat())
{
format.FormatFlags |= StringFormatFlags.NoWrap;
if (font.Height < bounds.Height)
{
format.LineAlignment = StringAlignment.Center;
}
if (!ControlUtils.IsSymbolFont(font))
{
gr.DrawString(name, font, brush, bounds, format);
}
else
{
gr.DrawString(name, normalFont, brush, bounds);
if (showPreview)
{
SizeF ef = gr.MeasureString(name + "w", normalFont);
RectangleF layoutRectangle = bounds;
layoutRectangle.Offset(ef.Width, 0f);
gr.DrawString(name, font, brush, layoutRectangle, format);
}
}
}
}
The "Cambria Math" is symbol font. But I found some interesting sings for this font. The font height
is more then other font height. For example, "Aril" font with size 14 have height 22, but "Cambria Math" have height 105.
As result to fix this issue need using Center Alignment to draw this font. But code below block it:
if (font.Height < bounds.Height)
{
format.LineAlignment = StringAlignment.Center;
}
font.Height is always create than bounds.Height for "Cambria Math" font. As result, I think, you must fix only this code, to fix this bug.
In attachment, font was draw with out center alignment.
Hello Mikhail,
Thank you for the additional information. We'll try to find a solution to this issue.
Thanks,
Nick