don't rely on fonts having a stream

Portable fonts don't have streams, so expect the stream open
to fail.

R=bungeman@google.com
TBR=cdalton@nvidia.com

Review URL: https://codereview.chromium.org/1185803003
This commit is contained in:
caryclark 2015-06-15 08:05:06 -07:00 committed by Commit bot
parent 1692bd12b5
commit f5c633f95d
2 changed files with 5 additions and 2 deletions

View File

@ -74,7 +74,6 @@ protected:
uint32_t glyphIDsCount) const override;
SkStreamAsset* onOpenStream(int* ttcIndex) const override {
SkASSERT(0); // don't expect to get here
return NULL;
}

View File

@ -113,7 +113,11 @@ GrPathRange* GrGLPathRendering::createGlyphs(const SkTypeface* typeface,
}
int faceIndex;
SkAutoTDelete<SkStream> fontStream(typeface->openStream(&faceIndex));
SkStreamAsset* asset = typeface->openStream(&faceIndex);
if (!asset) {
return GrPathRendering::createGlyphs(typeface, NULL, stroke);
}
SkAutoTDelete<SkStream> fontStream(asset);
const size_t fontDataLength = fontStream->getLength();
if (0 == fontDataLength) {