| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2006 Alexey Proskuryakov | 3 * Copyright (C) 2006 Alexey Proskuryakov |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 ascent = vdmxAscent; | 134 ascent = vdmxAscent; |
| 135 descent = -vdmxDescent; | 135 descent = -vdmxDescent; |
| 136 } else { | 136 } else { |
| 137 ascent = SkScalarRoundToInt(-metrics.fAscent); | 137 ascent = SkScalarRoundToInt(-metrics.fAscent); |
| 138 descent = SkScalarRoundToInt(metrics.fDescent); | 138 descent = SkScalarRoundToInt(metrics.fDescent); |
| 139 #if OS(LINUX) || OS(ANDROID) | 139 #if OS(LINUX) || OS(ANDROID) |
| 140 // When subpixel positioning is enabled, if the descent is rounded down,
the descent part | 140 // When subpixel positioning is enabled, if the descent is rounded down,
the descent part |
| 141 // of the glyph may be truncated when displayed in a 'overflow: hidden'
container. | 141 // of the glyph may be truncated when displayed in a 'overflow: hidden'
container. |
| 142 // To avoid that, borrow 1 unit from the ascent when possible. | 142 // To avoid that, borrow 1 unit from the ascent when possible. |
| 143 // FIXME: This can be removed if sub-pixel ascent/descent is supported. | 143 // FIXME: This can be removed if sub-pixel ascent/descent is supported. |
| 144 if (platformData().fontRenderStyle().useSubpixelPositioning && descent <
SkScalarToFloat(metrics.fDescent) && ascent >= 1) { | 144 if (platformData().getFontRenderStyle().useSubpixelPositioning && descen
t < SkScalarToFloat(metrics.fDescent) && ascent >= 1) { |
| 145 ++descent; | 145 ++descent; |
| 146 --ascent; | 146 --ascent; |
| 147 } | 147 } |
| 148 #endif | 148 #endif |
| 149 } | 149 } |
| 150 | 150 |
| 151 #if OS(MACOSX) | 151 #if OS(MACOSX) |
| 152 // We are preserving this ascent hack to match Safari's ascent adjustment | 152 // We are preserving this ascent hack to match Safari's ascent adjustment |
| 153 // in their SimpleFontDataMac.mm, for details see crbug.com/445830. | 153 // in their SimpleFontDataMac.mm, for details see crbug.com/445830. |
| 154 // We need to adjust Times, Helvetica, and Courier to closely match the | 154 // We need to adjust Times, Helvetica, and Courier to closely match the |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 if (glyphs[i]) { | 447 if (glyphs[i]) { |
| 448 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); | 448 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); |
| 449 haveGlyphs = true; | 449 haveGlyphs = true; |
| 450 } | 450 } |
| 451 } | 451 } |
| 452 | 452 |
| 453 return haveGlyphs; | 453 return haveGlyphs; |
| 454 } | 454 } |
| 455 | 455 |
| 456 } // namespace blink | 456 } // namespace blink |
| OLD | NEW |