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:
parent
ec08e9e780
commit
3b31f069f0
7 changed files with 336 additions and 248 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue