Bug 130163 - "Lucida Grande" is hardcoded in RenderTextControlSingleLine.cpp
Summary: "Lucida Grande" is hardcoded in RenderTextControlSingleLine.cpp
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-12 16:08 PDT by Myles C. Maxfield
Modified: 2023-07-02 16:13 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2014-03-12 16:08:19 PDT
Not all platforms use this default font, and there should be one source of truth for what the default font is.
Comment 1 Ahmad Saleem 2023-07-02 16:13:13 PDT
We still have this: https://searchfox.org/wubkat/source/Source/WebCore/rendering/RenderTextControlSingleLine.cpp#337 & 


#if !PLATFORM(IOS_FAMILY)
    // Since Lucida Grande is the default font, we want this to match the width
    // of MS Shell Dlg, the default font for textareas in Firefox, Safari Win and
    // IE for some encodings (in IE, the default font is encoding specific).
    // 901 is the avgCharWidth value in the OS/2 table for MS Shell Dlg.
    if (style().fontCascade().firstFamily() == "Lucida Grande"_s)
        return scaleEmToUnits(901);
#endif

_______

https://searchfox.org/wubkat/source/Source/WebCore/rendering/RenderTextControlSingleLine.cpp#360


#if !PLATFORM(IOS_FAMILY)
    const AtomString& family = style().fontCascade().firstFamily();
    // Since Lucida Grande is the default font, we want this to match the width
    // of MS Shell Dlg, the default font for textareas in Firefox, Safari Win and
    // IE for some encodings (in IE, the default font is encoding specific).
    // 4027 is the (xMax - xMin) value in the "head" font table for MS Shell Dlg.
    if (family == "Lucida Grande"_s)
        maxCharWidth = scaleEmToUnits(4027);
    else if (style().fontCascade().hasValidAverageCharWidth())
        maxCharWidth = roundf(style().fontCascade().primaryFont().maxCharWidth());
#endif

_______