Bug Report B96127
Visible to All Users

Font Edit doesn't paint the large height fonts in the dropdown

created 17 years ago

Font edit control (RepositoryItemFontEdit) don't draw "Cambria Math" font in drop down menu. See in attachment.
Steps to Reproduce:

  1. Create Windows Application
  2. Add BarManager
  3. Add Font Edit control
  4. Run application
  5. "Cambria Math" font don't draw in drop down menu
Show previous comments (1)

    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.

      DevExpress Support Team 17 years ago

        Hello Mikhail,
        Thank you for the additional information. We'll try to find a solution to this issue.
        Thanks,
        Nick

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.