| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 4 * Copyright (C) 2013 Google, Inc. All rights reserved. | 4 * Copyright (C) 2013 Google, Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // path map certain common bitmap fonts to their truetype equivalent up front. | 41 // path map certain common bitmap fonts to their truetype equivalent up front. |
| 42 inline const AtomicString& AdjustFamilyNameToAvoidUnsupportedFonts( | 42 inline const AtomicString& AdjustFamilyNameToAvoidUnsupportedFonts( |
| 43 const AtomicString& family_name) { | 43 const AtomicString& family_name) { |
| 44 #if OS(WIN) | 44 #if OS(WIN) |
| 45 // On Windows, 'Courier New' (truetype font) is always present and | 45 // On Windows, 'Courier New' (truetype font) is always present and |
| 46 // 'Courier' is a bitmap font. On Mac on the other hand 'Courier' is | 46 // 'Courier' is a bitmap font. On Mac on the other hand 'Courier' is |
| 47 // a truetype font. Thus pages asking for Courier are better of | 47 // a truetype font. Thus pages asking for Courier are better of |
| 48 // using 'Courier New' on windows. | 48 // using 'Courier New' on windows. |
| 49 DEFINE_STATIC_LOCAL(AtomicString, courier, ("Courier")); | 49 DEFINE_STATIC_LOCAL(AtomicString, courier, ("Courier")); |
| 50 DEFINE_STATIC_LOCAL(AtomicString, courier_new, ("Courier New")); | 50 DEFINE_STATIC_LOCAL(AtomicString, courier_new, ("Courier New")); |
| 51 if (EqualIgnoringCase(family_name, courier)) | 51 if (DeprecatedEqualIgnoringCase(family_name, courier)) |
| 52 return courier_new; | 52 return courier_new; |
| 53 | 53 |
| 54 // Alias 'MS Sans Serif' (bitmap font) -> 'Microsoft Sans Serif' | 54 // Alias 'MS Sans Serif' (bitmap font) -> 'Microsoft Sans Serif' |
| 55 // (truetype font). | 55 // (truetype font). |
| 56 DEFINE_STATIC_LOCAL(AtomicString, ms_sans, ("MS Sans Serif")); | 56 DEFINE_STATIC_LOCAL(AtomicString, ms_sans, ("MS Sans Serif")); |
| 57 DEFINE_STATIC_LOCAL(AtomicString, microsoft_sans, ("Microsoft Sans Serif")); | 57 DEFINE_STATIC_LOCAL(AtomicString, microsoft_sans, ("Microsoft Sans Serif")); |
| 58 if (EqualIgnoringCase(family_name, ms_sans)) | 58 if (DeprecatedEqualIgnoringCase(family_name, ms_sans)) |
| 59 return microsoft_sans; | 59 return microsoft_sans; |
| 60 | 60 |
| 61 // Alias 'MS Serif' (bitmap) -> 'Times New Roman' (truetype font). | 61 // Alias 'MS Serif' (bitmap) -> 'Times New Roman' (truetype font). |
| 62 // Alias 'Times' -> 'Times New Roman' (truetype font). | 62 // Alias 'Times' -> 'Times New Roman' (truetype font). |
| 63 // There's no 'Microsoft Sans Serif-equivalent' for Serif. | 63 // There's no 'Microsoft Sans Serif-equivalent' for Serif. |
| 64 DEFINE_STATIC_LOCAL(AtomicString, ms_serif, ("MS Serif")); | 64 DEFINE_STATIC_LOCAL(AtomicString, ms_serif, ("MS Serif")); |
| 65 DEFINE_STATIC_LOCAL(AtomicString, times, ("Times")); | 65 DEFINE_STATIC_LOCAL(AtomicString, times, ("Times")); |
| 66 DEFINE_STATIC_LOCAL(AtomicString, times_new_roman, ("Times New Roman")); | 66 DEFINE_STATIC_LOCAL(AtomicString, times_new_roman, ("Times New Roman")); |
| 67 if (EqualIgnoringCase(family_name, ms_serif) || | 67 if (DeprecatedEqualIgnoringCase(family_name, ms_serif) || |
| 68 EqualIgnoringCase(family_name, times)) | 68 DeprecatedEqualIgnoringCase(family_name, times)) |
| 69 return times_new_roman; | 69 return times_new_roman; |
| 70 #endif | 70 #endif |
| 71 | 71 |
| 72 return family_name; | 72 return family_name; |
| 73 } | 73 } |
| 74 | 74 |
| 75 inline const AtomicString& AlternateFamilyName( | 75 inline const AtomicString& AlternateFamilyName( |
| 76 const AtomicString& family_name) { | 76 const AtomicString& family_name) { |
| 77 // Alias Courier <-> Courier New | 77 // Alias Courier <-> Courier New |
| 78 DEFINE_STATIC_LOCAL(AtomicString, courier, ("Courier")); | 78 DEFINE_STATIC_LOCAL(AtomicString, courier, ("Courier")); |
| 79 DEFINE_STATIC_LOCAL(AtomicString, courier_new, ("Courier New")); | 79 DEFINE_STATIC_LOCAL(AtomicString, courier_new, ("Courier New")); |
| 80 if (EqualIgnoringCase(family_name, courier)) | 80 if (DeprecatedEqualIgnoringCase(family_name, courier)) |
| 81 return courier_new; | 81 return courier_new; |
| 82 #if !OS(WIN) | 82 #if !OS(WIN) |
| 83 // On Windows, Courier New (truetype font) is always present and | 83 // On Windows, Courier New (truetype font) is always present and |
| 84 // Courier is a bitmap font. So, we don't want to map Courier New to | 84 // Courier is a bitmap font. So, we don't want to map Courier New to |
| 85 // Courier. | 85 // Courier. |
| 86 if (EqualIgnoringCase(family_name, courier_new)) | 86 if (DeprecatedEqualIgnoringCase(family_name, courier_new)) |
| 87 return courier; | 87 return courier; |
| 88 #endif | 88 #endif |
| 89 | 89 |
| 90 // Alias Times and Times New Roman. | 90 // Alias Times and Times New Roman. |
| 91 DEFINE_STATIC_LOCAL(AtomicString, times, ("Times")); | 91 DEFINE_STATIC_LOCAL(AtomicString, times, ("Times")); |
| 92 DEFINE_STATIC_LOCAL(AtomicString, times_new_roman, ("Times New Roman")); | 92 DEFINE_STATIC_LOCAL(AtomicString, times_new_roman, ("Times New Roman")); |
| 93 if (EqualIgnoringCase(family_name, times)) | 93 if (DeprecatedEqualIgnoringCase(family_name, times)) |
| 94 return times_new_roman; | 94 return times_new_roman; |
| 95 if (EqualIgnoringCase(family_name, times_new_roman)) | 95 if (DeprecatedEqualIgnoringCase(family_name, times_new_roman)) |
| 96 return times; | 96 return times; |
| 97 | 97 |
| 98 // Alias Arial and Helvetica | 98 // Alias Arial and Helvetica |
| 99 DEFINE_STATIC_LOCAL(AtomicString, arial, ("Arial")); | 99 DEFINE_STATIC_LOCAL(AtomicString, arial, ("Arial")); |
| 100 DEFINE_STATIC_LOCAL(AtomicString, helvetica, ("Helvetica")); | 100 DEFINE_STATIC_LOCAL(AtomicString, helvetica, ("Helvetica")); |
| 101 if (EqualIgnoringCase(family_name, arial)) | 101 if (DeprecatedEqualIgnoringCase(family_name, arial)) |
| 102 return helvetica; | 102 return helvetica; |
| 103 if (EqualIgnoringCase(family_name, helvetica)) | 103 if (DeprecatedEqualIgnoringCase(family_name, helvetica)) |
| 104 return arial; | 104 return arial; |
| 105 | 105 |
| 106 return g_empty_atom; | 106 return g_empty_atom; |
| 107 } | 107 } |
| 108 | 108 |
| 109 inline const AtomicString GetFallbackFontFamily( | 109 inline const AtomicString GetFallbackFontFamily( |
| 110 const FontDescription& description) { | 110 const FontDescription& description) { |
| 111 DEFINE_STATIC_LOCAL(const AtomicString, sans_str, ("sans-serif")); | 111 DEFINE_STATIC_LOCAL(const AtomicString, sans_str, ("sans-serif")); |
| 112 DEFINE_STATIC_LOCAL(const AtomicString, serif_str, ("serif")); | 112 DEFINE_STATIC_LOCAL(const AtomicString, serif_str, ("serif")); |
| 113 DEFINE_STATIC_LOCAL(const AtomicString, monospace_str, ("monospace")); | 113 DEFINE_STATIC_LOCAL(const AtomicString, monospace_str, ("monospace")); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 127 return fantasy_str; | 127 return fantasy_str; |
| 128 default: | 128 default: |
| 129 // Let the caller use the system default font. | 129 // Let the caller use the system default font. |
| 130 return g_empty_atom; | 130 return g_empty_atom; |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace blink | 134 } // namespace blink |
| 135 | 135 |
| 136 #endif // AlternateFontFamily_h | 136 #endif // AlternateFontFamily_h |
| OLD | NEW |