1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:18:12 +00:00

LibTTF: Address code-style comments, gracefully handle load failures.

This commit is contained in:
Srimanta Barua 2020-06-14 18:32:39 +05:30 committed by Andreas Kling
parent ec08e9e780
commit 3b31f069f0
7 changed files with 336 additions and 248 deletions

View file

@ -24,8 +24,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "Cmap.h"
#include <AK/Optional.h>
#include <LibTTF/Cmap.h>
namespace TTF {
@ -148,4 +148,12 @@ u32 Cmap::glyph_id_for_codepoint(u32 codepoint) const
return subtable.glyph_id_for_codepoint(codepoint);
}
Optional<Cmap> Cmap::from_slice(const ByteBuffer& slice)
{
if (slice.size() < (size_t) Sizes::TableHeader) {
return {};
}
return Cmap(slice);
}
}