Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: Source/core/svg/SVGFontData.cpp

Issue 244253003: SimpleFontData::fillGlyphPage should not set zero for missing glyphs (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix expectation Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 return fillNonBMPGlyphs(fontElement, pageToFill, offset, length, buffer, fon tData); 249 return fillNonBMPGlyphs(fontElement, pageToFill, offset, length, buffer, fon tData);
250 } 250 }
251 251
252 bool SVGFontData::fillBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageToFi ll, unsigned offset, unsigned length, UChar* buffer, const SimpleFontData* fontD ata) const 252 bool SVGFontData::fillBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageToFi ll, unsigned offset, unsigned length, UChar* buffer, const SimpleFontData* fontD ata) const
253 { 253 {
254 bool haveGlyphs = false; 254 bool haveGlyphs = false;
255 Vector<SVGGlyph> glyphs; 255 Vector<SVGGlyph> glyphs;
256 for (unsigned i = 0; i < length; ++i) { 256 for (unsigned i = 0; i < length; ++i) {
257 String lookupString(buffer + i, 1); 257 String lookupString(buffer + i, 1);
258 fontElement->collectGlyphsForString(lookupString, glyphs); 258 fontElement->collectGlyphsForString(lookupString, glyphs);
259 if (glyphs.isEmpty()) { 259 if (glyphs.isEmpty())
260 pageToFill->setGlyphDataForIndex(offset + i, 0, 0);
261 continue; 260 continue;
262 }
263 261
264 // Associate entry in glyph page with first valid SVGGlyph. 262 // Associate entry in glyph page with first valid SVGGlyph.
265 // If there are multiple valid ones, just take the first one. WidthItera tor will take 263 // If there are multiple valid ones, just take the first one. WidthItera tor will take
266 // care of matching to the correct glyph, if multiple ones are available , as that's 264 // care of matching to the correct glyph, if multiple ones are available , as that's
267 // only possible within the context of a string (eg. arabic form matchin g). 265 // only possible within the context of a string (eg. arabic form matchin g).
268 haveGlyphs = true; 266 haveGlyphs = true;
269 pageToFill->setGlyphDataForIndex(offset + i, glyphs.first().tableEntry, fontData); 267 pageToFill->setGlyphDataForIndex(offset + i, glyphs.first().tableEntry, fontData);
270 glyphs.clear(); 268 glyphs.clear();
271 } 269 }
272 270
273 return haveGlyphs; 271 return haveGlyphs;
274 } 272 }
275 273
276 bool SVGFontData::fillNonBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageT oFill, unsigned offset, unsigned length, UChar* buffer, const SimpleFontData* fo ntData) const 274 bool SVGFontData::fillNonBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageT oFill, unsigned offset, unsigned length, UChar* buffer, const SimpleFontData* fo ntData) const
277 { 275 {
278 bool haveGlyphs = false; 276 bool haveGlyphs = false;
279 Vector<SVGGlyph> glyphs; 277 Vector<SVGGlyph> glyphs;
280 for (unsigned i = 0; i < length; ++i) { 278 for (unsigned i = 0; i < length; ++i) {
281 // Each character here consists of a surrogate pair 279 // Each character here consists of a surrogate pair
282 String lookupString(buffer + i * 2, 2); 280 String lookupString(buffer + i * 2, 2);
283 fontElement->collectGlyphsForString(lookupString, glyphs); 281 fontElement->collectGlyphsForString(lookupString, glyphs);
284 if (glyphs.isEmpty()) { 282 if (glyphs.isEmpty())
285 pageToFill->setGlyphDataForIndex(offset + i, 0, 0);
286 continue; 283 continue;
287 }
288 284
289 // Associate entry in glyph page with first valid SVGGlyph. 285 // Associate entry in glyph page with first valid SVGGlyph.
290 // If there are multiple valid ones, just take the first one. WidthItera tor will take 286 // If there are multiple valid ones, just take the first one. WidthItera tor will take
291 // care of matching to the correct glyph, if multiple ones are available , as that's 287 // care of matching to the correct glyph, if multiple ones are available , as that's
292 // only possible within the context of a string (eg. arabic form matchin g). 288 // only possible within the context of a string (eg. arabic form matchin g).
293 haveGlyphs = true; 289 haveGlyphs = true;
294 pageToFill->setGlyphDataForIndex(offset + i, glyphs.first().tableEntry, fontData); 290 pageToFill->setGlyphDataForIndex(offset + i, glyphs.first().tableEntry, fontData);
295 glyphs.clear(); 291 glyphs.clear();
296 } 292 }
297 293
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 330
335 bool SVGFontData::shouldSkipDrawing() const 331 bool SVGFontData::shouldSkipDrawing() const
336 { 332 {
337 // FIXME: (http://crbug.com/359380) Glyph may be referenced after removeNode from the current editing impl. 333 // FIXME: (http://crbug.com/359380) Glyph may be referenced after removeNode from the current editing impl.
338 return !m_svgFontFaceElement || !m_svgFontFaceElement->inDocument(); 334 return !m_svgFontFaceElement || !m_svgFontFaceElement->inDocument();
339 } 335 }
340 336
341 } // namespace WebCore 337 } // namespace WebCore
342 338
343 #endif 339 #endif
OLDNEW
« no previous file with comments | « LayoutTests/svg/custom/svg-fonts-segmented.xhtml ('k') | Source/platform/fonts/GlyphPageTreeNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698