From a71960051482af5fb6c0fac6f064dde32df7f56f Mon Sep 17 00:00:00 2001 From: Martin Srank Date: Thu, 31 Mar 2022 17:15:40 +0200 Subject: [PATCH] Add support for all WOFF/WOFF2 flavors --- filetype/types/font.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/filetype/types/font.py b/filetype/types/font.py index bdecf39..7d3b19f 100644 --- a/filetype/types/font.py +++ b/filetype/types/font.py @@ -19,15 +19,11 @@ def __init__(self): ) def match(self, buf): - return (len(buf) > 7 and + return (len(buf) > 3 and buf[0] == 0x77 and buf[1] == 0x4F and buf[2] == 0x46 and - buf[3] == 0x46 and - buf[4] == 0x00 and - buf[5] == 0x01 and - buf[6] == 0x00 and - buf[7] == 0x00) + buf[3] == 0x46) class Woff2(Type): @@ -44,15 +40,11 @@ def __init__(self): ) def match(self, buf): - return (len(buf) > 7 and + return (len(buf) > 3 and buf[0] == 0x77 and buf[1] == 0x4F and buf[2] == 0x46 and - buf[3] == 0x32 and - buf[4] == 0x00 and - buf[5] == 0x01 and - buf[6] == 0x00 and - buf[7] == 0x00) + buf[3] == 0x32) class Ttf(Type):