OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // However, it can be slightly bigger than the original one due to | 70 // However, it can be slightly bigger than the original one due to |
71 // name table replacement and/or padding for glyf table. | 71 // name table replacement and/or padding for glyf table. |
72 // | 72 // |
73 // With WOFF fonts, however, we'll be decompressing, so the result can be | 73 // With WOFF fonts, however, we'll be decompressing, so the result can be |
74 // much larger than the original. | 74 // much larger than the original. |
75 | 75 |
76 ots::ExpandingMemoryStream output(m_buffer->size(), maxWebFontSize); | 76 ots::ExpandingMemoryStream output(m_buffer->size(), maxWebFontSize); |
77 double start = currentTime(); | 77 double start = currentTime(); |
78 BlinkOTSContext otsContext; | 78 BlinkOTSContext otsContext; |
79 | 79 |
80 if (!otsContext.Process(&output, reinterpret_cast<const uint8_t*>(m_buffer->
data()), m_buffer->size())) | 80 if (!otsContext.Process(&output, reinterpret_cast<const uint8_t*>(m_buffer->
data()), m_buffer->size())) { |
| 81 setParsingError(true); |
| 82 setErrorString(otsContext.getErrorString()); |
81 return nullptr; | 83 return nullptr; |
| 84 } |
82 | 85 |
| 86 setParsingError(false); |
| 87 setErrorString(otsContext.getErrorString()); |
83 const size_t transcodeLen = output.Tell(); | 88 const size_t transcodeLen = output.Tell(); |
84 recordDecodeSpeedHistogram(m_buffer, currentTime() - start, transcodeLen); | 89 recordDecodeSpeedHistogram(m_buffer, currentTime() - start, transcodeLen); |
85 return SharedBuffer::create(static_cast<unsigned char*>(output.get()), trans
codeLen); | 90 return SharedBuffer::create(static_cast<unsigned char*>(output.get()), trans
codeLen); |
86 } | 91 } |
87 | 92 |
88 bool OpenTypeSanitizer::supportsFormat(const String& format) | 93 bool OpenTypeSanitizer::supportsFormat(const String& format) |
89 { | 94 { |
90 return equalIgnoringCase(format, "woff") || equalIgnoringCase(format, "woff2
"); | 95 return equalIgnoringCase(format, "woff") || equalIgnoringCase(format, "woff2
"); |
91 } | 96 } |
92 | 97 |
93 } // namespace blink | 98 } // namespace blink |
OLD | NEW |