polyfile-weave 0.5.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of polyfile-weave might be problematic. Click here for more details.
- polyfile/__init__.py +15 -0
- polyfile/__main__.py +394 -0
- polyfile/arithmetic.py +27 -0
- polyfile/ast.py +114 -0
- polyfile/debugger.py +1039 -0
- polyfile/expressions.py +346 -0
- polyfile/fileutils.py +343 -0
- polyfile/html.py +135 -0
- polyfile/http/__init__.py +1 -0
- polyfile/http/defacto.py +37 -0
- polyfile/http/deprecated.py +51 -0
- polyfile/http/experimental.py +67 -0
- polyfile/http/http_11.py +548 -0
- polyfile/http/matcher.py +37 -0
- polyfile/http/structured_headers.py +48 -0
- polyfile/iterators.py +72 -0
- polyfile/jpeg.py +24 -0
- polyfile/kaitai/__init__.py +0 -0
- polyfile/kaitai/compiler.py +156 -0
- polyfile/kaitai/parser.py +312 -0
- polyfile/kaitai/parsers/__init__.py +0 -0
- polyfile/kaitai/parsers/aix_utmp.py +116 -0
- polyfile/kaitai/parsers/allegro_dat.py +367 -0
- polyfile/kaitai/parsers/andes_firmware.py +64 -0
- polyfile/kaitai/parsers/android_bootldr_asus.py +105 -0
- polyfile/kaitai/parsers/android_bootldr_huawei.py +181 -0
- polyfile/kaitai/parsers/android_bootldr_qcom.py +217 -0
- polyfile/kaitai/parsers/android_dto.py +138 -0
- polyfile/kaitai/parsers/android_img.py +319 -0
- polyfile/kaitai/parsers/android_nanoapp_header.py +83 -0
- polyfile/kaitai/parsers/android_opengl_shaders_cache.py +151 -0
- polyfile/kaitai/parsers/android_sparse.py +237 -0
- polyfile/kaitai/parsers/android_super.py +401 -0
- polyfile/kaitai/parsers/apm_partition_table.py +196 -0
- polyfile/kaitai/parsers/apple_single_double.py +180 -0
- polyfile/kaitai/parsers/asn1_der.py +235 -0
- polyfile/kaitai/parsers/au.py +138 -0
- polyfile/kaitai/parsers/avantes_roh60.py +112 -0
- polyfile/kaitai/parsers/avi.py +296 -0
- polyfile/kaitai/parsers/bcd.py +111 -0
- polyfile/kaitai/parsers/bitcoin_transaction.py +210 -0
- polyfile/kaitai/parsers/blender_blend.py +334 -0
- polyfile/kaitai/parsers/bmp.py +780 -0
- polyfile/kaitai/parsers/bson.py +411 -0
- polyfile/kaitai/parsers/btrfs_stream.py +318 -0
- polyfile/kaitai/parsers/bytes_with_io.py +27 -0
- polyfile/kaitai/parsers/chrome_pak.py +194 -0
- polyfile/kaitai/parsers/code_6502.py +456 -0
- polyfile/kaitai/parsers/compressed_resource.py +217 -0
- polyfile/kaitai/parsers/cpio_old_le.py +154 -0
- polyfile/kaitai/parsers/cramfs.py +344 -0
- polyfile/kaitai/parsers/creative_voice_file.py +342 -0
- polyfile/kaitai/parsers/dbf.py +274 -0
- polyfile/kaitai/parsers/dcmp_0.py +664 -0
- polyfile/kaitai/parsers/dcmp_1.py +422 -0
- polyfile/kaitai/parsers/dcmp_2.py +312 -0
- polyfile/kaitai/parsers/dcmp_variable_length_integer.py +66 -0
- polyfile/kaitai/parsers/dex.py +1086 -0
- polyfile/kaitai/parsers/dicom.py +4370 -0
- polyfile/kaitai/parsers/dime_message.py +201 -0
- polyfile/kaitai/parsers/dns_packet.py +569 -0
- polyfile/kaitai/parsers/doom_wad.py +654 -0
- polyfile/kaitai/parsers/dos_datetime.py +191 -0
- polyfile/kaitai/parsers/dos_mz.py +172 -0
- polyfile/kaitai/parsers/ds_store.py +513 -0
- polyfile/kaitai/parsers/dtb.py +310 -0
- polyfile/kaitai/parsers/dune_2_pak.py +126 -0
- polyfile/kaitai/parsers/edid.py +472 -0
- polyfile/kaitai/parsers/efivar_signature_list.py +331 -0
- polyfile/kaitai/parsers/elf.py +2482 -0
- polyfile/kaitai/parsers/ethernet_frame.py +114 -0
- polyfile/kaitai/parsers/exif.py +723 -0
- polyfile/kaitai/parsers/ext2.py +537 -0
- polyfile/kaitai/parsers/fallout2_dat.py +187 -0
- polyfile/kaitai/parsers/fallout_dat.py +156 -0
- polyfile/kaitai/parsers/fasttracker_xm_module.py +558 -0
- polyfile/kaitai/parsers/ftl_dat.py +90 -0
- polyfile/kaitai/parsers/genmidi_op2.py +161 -0
- polyfile/kaitai/parsers/gettext_mo.py +541 -0
- polyfile/kaitai/parsers/gif.py +492 -0
- polyfile/kaitai/parsers/gimp_brush.py +244 -0
- polyfile/kaitai/parsers/glibc_utmp.py +114 -0
- polyfile/kaitai/parsers/gltf_binary.py +132 -0
- polyfile/kaitai/parsers/google_protobuf.py +151 -0
- polyfile/kaitai/parsers/gpt_partition_table.py +175 -0
- polyfile/kaitai/parsers/gran_turismo_vol.py +140 -0
- polyfile/kaitai/parsers/grub2_font.py +337 -0
- polyfile/kaitai/parsers/gzip.py +232 -0
- polyfile/kaitai/parsers/hashcat_restore.py +60 -0
- polyfile/kaitai/parsers/hccap.py +111 -0
- polyfile/kaitai/parsers/hccapx.py +103 -0
- polyfile/kaitai/parsers/heaps_pak.py +177 -0
- polyfile/kaitai/parsers/heroes_of_might_and_magic_agg.py +116 -0
- polyfile/kaitai/parsers/heroes_of_might_and_magic_bmp.py +34 -0
- polyfile/kaitai/parsers/icmp_packet.py +136 -0
- polyfile/kaitai/parsers/ico.py +129 -0
- polyfile/kaitai/parsers/id3v1_1.py +220 -0
- polyfile/kaitai/parsers/id3v2_3.py +324 -0
- polyfile/kaitai/parsers/id3v2_4.py +423 -0
- polyfile/kaitai/parsers/ines.py +282 -0
- polyfile/kaitai/parsers/ipv4_packet.py +158 -0
- polyfile/kaitai/parsers/ipv6_packet.py +55 -0
- polyfile/kaitai/parsers/iso9660.py +544 -0
- polyfile/kaitai/parsers/java_class.py +1113 -0
- polyfile/kaitai/parsers/jpeg.py +361 -0
- polyfile/kaitai/parsers/luks.py +149 -0
- polyfile/kaitai/parsers/lzh.py +165 -0
- polyfile/kaitai/parsers/mac_os_resource_snd.py +493 -0
- polyfile/kaitai/parsers/mach_o.py +3033 -0
- polyfile/kaitai/parsers/mach_o_fat.py +92 -0
- polyfile/kaitai/parsers/magicavoxel_vox.py +391 -0
- polyfile/kaitai/parsers/manifest.json +1 -0
- polyfile/kaitai/parsers/mbr_partition_table.py +119 -0
- polyfile/kaitai/parsers/mcap.py +1015 -0
- polyfile/kaitai/parsers/microsoft_cfb.py +293 -0
- polyfile/kaitai/parsers/microsoft_network_monitor_v2.py +309 -0
- polyfile/kaitai/parsers/microsoft_pe.py +765 -0
- polyfile/kaitai/parsers/mifare_classic.py +706 -0
- polyfile/kaitai/parsers/minecraft_nbt.py +449 -0
- polyfile/kaitai/parsers/monomakh_sapr_chg.py +69 -0
- polyfile/kaitai/parsers/mozilla_mar.py +239 -0
- polyfile/kaitai/parsers/mp4.py +333 -0
- polyfile/kaitai/parsers/msgpack.py +467 -0
- polyfile/kaitai/parsers/nitf.py +1189 -0
- polyfile/kaitai/parsers/nt_mdt_pal.py +155 -0
- polyfile/kaitai/parsers/ogg.py +118 -0
- polyfile/kaitai/parsers/openpgp_message.py +993 -0
- polyfile/kaitai/parsers/packet_ppi.py +515 -0
- polyfile/kaitai/parsers/pcap.py +344 -0
- polyfile/kaitai/parsers/pcf_font.py +506 -0
- polyfile/kaitai/parsers/pcx.py +195 -0
- polyfile/kaitai/parsers/pcx_dcx.py +79 -0
- polyfile/kaitai/parsers/phar_without_stub.py +399 -0
- polyfile/kaitai/parsers/php_serialized_value.py +505 -0
- polyfile/kaitai/parsers/png.py +721 -0
- polyfile/kaitai/parsers/protocol_body.py +260 -0
- polyfile/kaitai/parsers/psx_tim.py +104 -0
- polyfile/kaitai/parsers/python_pickle.py +718 -0
- polyfile/kaitai/parsers/python_pyc_27.py +510 -0
- polyfile/kaitai/parsers/quake_mdl.py +441 -0
- polyfile/kaitai/parsers/quake_pak.py +112 -0
- polyfile/kaitai/parsers/quicktime_mov.py +634 -0
- polyfile/kaitai/parsers/rar.py +265 -0
- polyfile/kaitai/parsers/regf.py +569 -0
- polyfile/kaitai/parsers/renderware_binary_stream.py +877 -0
- polyfile/kaitai/parsers/resource_fork.py +611 -0
- polyfile/kaitai/parsers/respack.py +57 -0
- polyfile/kaitai/parsers/riff.py +409 -0
- polyfile/kaitai/parsers/rpm.py +964 -0
- polyfile/kaitai/parsers/rtcp_payload.py +579 -0
- polyfile/kaitai/parsers/rtp_packet.py +150 -0
- polyfile/kaitai/parsers/rtpdump.py +115 -0
- polyfile/kaitai/parsers/ruby_marshal.py +423 -0
- polyfile/kaitai/parsers/s3m.py +493 -0
- polyfile/kaitai/parsers/saints_row_2_vpp_pc.py +254 -0
- polyfile/kaitai/parsers/shapefile_index.py +174 -0
- polyfile/kaitai/parsers/shapefile_main.py +893 -0
- polyfile/kaitai/parsers/some_ip.py +209 -0
- polyfile/kaitai/parsers/some_ip_container.py +37 -0
- polyfile/kaitai/parsers/some_ip_sd.py +86 -0
- polyfile/kaitai/parsers/some_ip_sd_entries.py +160 -0
- polyfile/kaitai/parsers/some_ip_sd_options.py +374 -0
- polyfile/kaitai/parsers/specpr.py +404 -0
- polyfile/kaitai/parsers/sqlite3.py +472 -0
- polyfile/kaitai/parsers/ssh_public_key.py +252 -0
- polyfile/kaitai/parsers/standard_midi_file.py +390 -0
- polyfile/kaitai/parsers/stl.py +111 -0
- polyfile/kaitai/parsers/sudoers_ts.py +201 -0
- polyfile/kaitai/parsers/swf.py +406 -0
- polyfile/kaitai/parsers/systemd_journal.py +361 -0
- polyfile/kaitai/parsers/tcp_segment.py +57 -0
- polyfile/kaitai/parsers/tga.py +213 -0
- polyfile/kaitai/parsers/tls_client_hello.py +293 -0
- polyfile/kaitai/parsers/tr_dos_image.py +322 -0
- polyfile/kaitai/parsers/tsm.py +198 -0
- polyfile/kaitai/parsers/ttf.py +1847 -0
- polyfile/kaitai/parsers/udp_datagram.py +42 -0
- polyfile/kaitai/parsers/uefi_te.py +236 -0
- polyfile/kaitai/parsers/uimage.py +198 -0
- polyfile/kaitai/parsers/utf8_string.py +137 -0
- polyfile/kaitai/parsers/vfat.py +410 -0
- polyfile/kaitai/parsers/vlq_base128_be.py +104 -0
- polyfile/kaitai/parsers/vlq_base128_le.py +129 -0
- polyfile/kaitai/parsers/vmware_vmdk.py +167 -0
- polyfile/kaitai/parsers/vp8_ivf.py +112 -0
- polyfile/kaitai/parsers/warcraft_2_pud.py +423 -0
- polyfile/kaitai/parsers/wav.py +1014 -0
- polyfile/kaitai/parsers/websocket.py +167 -0
- polyfile/kaitai/parsers/windows_evt_log.py +304 -0
- polyfile/kaitai/parsers/windows_lnk_file.py +467 -0
- polyfile/kaitai/parsers/windows_minidump.py +575 -0
- polyfile/kaitai/parsers/windows_resource_file.py +243 -0
- polyfile/kaitai/parsers/windows_shell_items.py +190 -0
- polyfile/kaitai/parsers/windows_systemtime.py +52 -0
- polyfile/kaitai/parsers/wmf.py +502 -0
- polyfile/kaitai/parsers/xar.py +181 -0
- polyfile/kaitai/parsers/xwd.py +189 -0
- polyfile/kaitai/parsers/zip.py +685 -0
- polyfile/kaitai/parsers/zisofs.py +158 -0
- polyfile/kaitai/parsers/zx_spectrum_tap.py +184 -0
- polyfile/kaitaimatcher.py +113 -0
- polyfile/languagematcher.py +217 -0
- polyfile/logger.py +135 -0
- polyfile/magic.py +2983 -0
- polyfile/magic_defs/COPYING +29 -0
- polyfile/magic_defs/__init__.py +0 -0
- polyfile/magic_defs/acorn +102 -0
- polyfile/magic_defs/adi +13 -0
- polyfile/magic_defs/adventure +122 -0
- polyfile/magic_defs/aes +29 -0
- polyfile/magic_defs/algol68 +35 -0
- polyfile/magic_defs/allegro +9 -0
- polyfile/magic_defs/alliant +18 -0
- polyfile/magic_defs/alpha +32 -0
- polyfile/magic_defs/amanda +12 -0
- polyfile/magic_defs/amigaos +218 -0
- polyfile/magic_defs/android +259 -0
- polyfile/magic_defs/animation +1197 -0
- polyfile/magic_defs/aout +46 -0
- polyfile/magic_defs/apache +28 -0
- polyfile/magic_defs/apl +7 -0
- polyfile/magic_defs/apple +773 -0
- polyfile/magic_defs/application +7 -0
- polyfile/magic_defs/applix +13 -0
- polyfile/magic_defs/apt +52 -0
- polyfile/magic_defs/archive +2586 -0
- polyfile/magic_defs/aria +38 -0
- polyfile/magic_defs/arm +50 -0
- polyfile/magic_defs/asf +132 -0
- polyfile/magic_defs/assembler +18 -0
- polyfile/magic_defs/asterix +18 -0
- polyfile/magic_defs/att3b +41 -0
- polyfile/magic_defs/audio +1291 -0
- polyfile/magic_defs/avm +33 -0
- polyfile/magic_defs/basis +18 -0
- polyfile/magic_defs/beetle +7 -0
- polyfile/magic_defs/ber +65 -0
- polyfile/magic_defs/bflt +14 -0
- polyfile/magic_defs/bhl +10 -0
- polyfile/magic_defs/bioinformatics +178 -0
- polyfile/magic_defs/biosig +154 -0
- polyfile/magic_defs/blackberry +8 -0
- polyfile/magic_defs/blcr +25 -0
- polyfile/magic_defs/blender +50 -0
- polyfile/magic_defs/blit +24 -0
- polyfile/magic_defs/bm +10 -0
- polyfile/magic_defs/bout +11 -0
- polyfile/magic_defs/bsdi +33 -0
- polyfile/magic_defs/bsi +10 -0
- polyfile/magic_defs/btsnoop +13 -0
- polyfile/magic_defs/burp +7 -0
- polyfile/magic_defs/bytecode +41 -0
- polyfile/magic_defs/c-lang +110 -0
- polyfile/magic_defs/c64 +531 -0
- polyfile/magic_defs/cad +437 -0
- polyfile/magic_defs/cafebabe +107 -0
- polyfile/magic_defs/cbor +21 -0
- polyfile/magic_defs/ccf +14 -0
- polyfile/magic_defs/cddb +12 -0
- polyfile/magic_defs/chord +15 -0
- polyfile/magic_defs/cisco +12 -0
- polyfile/magic_defs/citrus +12 -0
- polyfile/magic_defs/clarion +27 -0
- polyfile/magic_defs/claris +48 -0
- polyfile/magic_defs/clipper +65 -0
- polyfile/magic_defs/clojure +30 -0
- polyfile/magic_defs/coff +98 -0
- polyfile/magic_defs/commands +201 -0
- polyfile/magic_defs/communications +22 -0
- polyfile/magic_defs/compress +461 -0
- polyfile/magic_defs/console +1213 -0
- polyfile/magic_defs/convex +69 -0
- polyfile/magic_defs/coverage +91 -0
- polyfile/magic_defs/cracklib +14 -0
- polyfile/magic_defs/crypto +31 -0
- polyfile/magic_defs/csv +8 -0
- polyfile/magic_defs/ctags +6 -0
- polyfile/magic_defs/ctf +23 -0
- polyfile/magic_defs/cubemap +8 -0
- polyfile/magic_defs/cups +56 -0
- polyfile/magic_defs/dact +11 -0
- polyfile/magic_defs/database +886 -0
- polyfile/magic_defs/dataone +47 -0
- polyfile/magic_defs/dbpf +15 -0
- polyfile/magic_defs/der +146 -0
- polyfile/magic_defs/diamond +12 -0
- polyfile/magic_defs/dif +33 -0
- polyfile/magic_defs/diff +41 -0
- polyfile/magic_defs/digital +59 -0
- polyfile/magic_defs/dolby +69 -0
- polyfile/magic_defs/dsf +25 -0
- polyfile/magic_defs/dump +96 -0
- polyfile/magic_defs/dwarfs +45 -0
- polyfile/magic_defs/dyadic +61 -0
- polyfile/magic_defs/ebml +8 -0
- polyfile/magic_defs/edid +11 -0
- polyfile/magic_defs/editors +43 -0
- polyfile/magic_defs/efi +15 -0
- polyfile/magic_defs/elf +379 -0
- polyfile/magic_defs/encore +22 -0
- polyfile/magic_defs/epoc +62 -0
- polyfile/magic_defs/erlang +21 -0
- polyfile/magic_defs/espressif +57 -0
- polyfile/magic_defs/esri +28 -0
- polyfile/magic_defs/etf +33 -0
- polyfile/magic_defs/fcs +9 -0
- polyfile/magic_defs/filesystems +2694 -0
- polyfile/magic_defs/finger +16 -0
- polyfile/magic_defs/firmware +133 -0
- polyfile/magic_defs/flash +62 -0
- polyfile/magic_defs/flif +36 -0
- polyfile/magic_defs/fonts +449 -0
- polyfile/magic_defs/forth +82 -0
- polyfile/magic_defs/fortran +9 -0
- polyfile/magic_defs/frame +62 -0
- polyfile/magic_defs/freebsd +164 -0
- polyfile/magic_defs/fsav +128 -0
- polyfile/magic_defs/fusecompress +12 -0
- polyfile/magic_defs/games +696 -0
- polyfile/magic_defs/gcc +17 -0
- polyfile/magic_defs/gconv +10 -0
- polyfile/magic_defs/gentoo +85 -0
- polyfile/magic_defs/geo +166 -0
- polyfile/magic_defs/geos +20 -0
- polyfile/magic_defs/gimp +77 -0
- polyfile/magic_defs/git +13 -0
- polyfile/magic_defs/glibc +21 -0
- polyfile/magic_defs/gnome +59 -0
- polyfile/magic_defs/gnu +173 -0
- polyfile/magic_defs/gnumeric +8 -0
- polyfile/magic_defs/gpt +240 -0
- polyfile/magic_defs/gpu +28 -0
- polyfile/magic_defs/grace +21 -0
- polyfile/magic_defs/graphviz +12 -0
- polyfile/magic_defs/gringotts +48 -0
- polyfile/magic_defs/guile +13 -0
- polyfile/magic_defs/hardware +12 -0
- polyfile/magic_defs/hitachi-sh +30 -0
- polyfile/magic_defs/hp +433 -0
- polyfile/magic_defs/human68k +26 -0
- polyfile/magic_defs/ibm370 +52 -0
- polyfile/magic_defs/ibm6000 +35 -0
- polyfile/magic_defs/icc +214 -0
- polyfile/magic_defs/iff +80 -0
- polyfile/magic_defs/images +4210 -0
- polyfile/magic_defs/inform +9 -0
- polyfile/magic_defs/intel +310 -0
- polyfile/magic_defs/interleaf +9 -0
- polyfile/magic_defs/island +10 -0
- polyfile/magic_defs/ispell +63 -0
- polyfile/magic_defs/isz +15 -0
- polyfile/magic_defs/java +52 -0
- polyfile/magic_defs/javascript +171 -0
- polyfile/magic_defs/jpeg +252 -0
- polyfile/magic_defs/json +8 -0
- polyfile/magic_defs/karma +9 -0
- polyfile/magic_defs/kde +11 -0
- polyfile/magic_defs/keepass +20 -0
- polyfile/magic_defs/kerberos +45 -0
- polyfile/magic_defs/kicad +85 -0
- polyfile/magic_defs/kml +34 -0
- polyfile/magic_defs/lammps +64 -0
- polyfile/magic_defs/lecter +6 -0
- polyfile/magic_defs/lex +12 -0
- polyfile/magic_defs/lif +50 -0
- polyfile/magic_defs/linux +557 -0
- polyfile/magic_defs/lisp +78 -0
- polyfile/magic_defs/llvm +22 -0
- polyfile/magic_defs/locoscript +12 -0
- polyfile/magic_defs/lua +31 -0
- polyfile/magic_defs/luks +126 -0
- polyfile/magic_defs/m4 +11 -0
- polyfile/magic_defs/mach +303 -0
- polyfile/magic_defs/macintosh +505 -0
- polyfile/magic_defs/macos +7 -0
- polyfile/magic_defs/magic +10 -0
- polyfile/magic_defs/magic.mgc +0 -0
- polyfile/magic_defs/mail.news +132 -0
- polyfile/magic_defs/make +21 -0
- polyfile/magic_defs/map +413 -0
- polyfile/magic_defs/maple +109 -0
- polyfile/magic_defs/marc21 +30 -0
- polyfile/magic_defs/mathcad +8 -0
- polyfile/magic_defs/mathematica +188 -0
- polyfile/magic_defs/matroska +17 -0
- polyfile/magic_defs/mcrypt +52 -0
- polyfile/magic_defs/measure +44 -0
- polyfile/magic_defs/mercurial +13 -0
- polyfile/magic_defs/metastore +8 -0
- polyfile/magic_defs/meteorological +53 -0
- polyfile/magic_defs/microfocus +21 -0
- polyfile/magic_defs/mime +9 -0
- polyfile/magic_defs/mips +120 -0
- polyfile/magic_defs/mirage +8 -0
- polyfile/magic_defs/misctools +140 -0
- polyfile/magic_defs/mkid +11 -0
- polyfile/magic_defs/mlssa +8 -0
- polyfile/magic_defs/mmdf +6 -0
- polyfile/magic_defs/modem +92 -0
- polyfile/magic_defs/modulefile +9 -0
- polyfile/magic_defs/motorola +71 -0
- polyfile/magic_defs/mozilla +37 -0
- polyfile/magic_defs/msdos +2304 -0
- polyfile/magic_defs/msooxml +68 -0
- polyfile/magic_defs/msvc +222 -0
- polyfile/magic_defs/msx +309 -0
- polyfile/magic_defs/mup +24 -0
- polyfile/magic_defs/music +17 -0
- polyfile/magic_defs/nasa +7 -0
- polyfile/magic_defs/natinst +24 -0
- polyfile/magic_defs/ncr +49 -0
- polyfile/magic_defs/neko +12 -0
- polyfile/magic_defs/netbsd +251 -0
- polyfile/magic_defs/netscape +26 -0
- polyfile/magic_defs/netware +11 -0
- polyfile/magic_defs/news +13 -0
- polyfile/magic_defs/nifty +202 -0
- polyfile/magic_defs/nim-lang +29 -0
- polyfile/magic_defs/nitpicker +14 -0
- polyfile/magic_defs/numpy +9 -0
- polyfile/magic_defs/oasis +12 -0
- polyfile/magic_defs/ocaml +14 -0
- polyfile/magic_defs/octave +6 -0
- polyfile/magic_defs/ole2compounddocs +760 -0
- polyfile/magic_defs/olf +98 -0
- polyfile/magic_defs/openfst +17 -0
- polyfile/magic_defs/opentimestamps +16 -0
- polyfile/magic_defs/oric +16 -0
- polyfile/magic_defs/os2 +186 -0
- polyfile/magic_defs/os400 +39 -0
- polyfile/magic_defs/os9 +80 -0
- polyfile/magic_defs/osf1 +10 -0
- polyfile/magic_defs/palm +156 -0
- polyfile/magic_defs/parix +13 -0
- polyfile/magic_defs/parrot +22 -0
- polyfile/magic_defs/pascal +39 -0
- polyfile/magic_defs/pbf +11 -0
- polyfile/magic_defs/pbm +8 -0
- polyfile/magic_defs/pc88 +24 -0
- polyfile/magic_defs/pc98 +77 -0
- polyfile/magic_defs/pci_ids +116 -0
- polyfile/magic_defs/pcjr +8 -0
- polyfile/magic_defs/pdf +51 -0
- polyfile/magic_defs/pdp +42 -0
- polyfile/magic_defs/perl +100 -0
- polyfile/magic_defs/pgf +52 -0
- polyfile/magic_defs/pgp +581 -0
- polyfile/magic_defs/pgp-binary-keys +388 -0
- polyfile/magic_defs/pkgadd +7 -0
- polyfile/magic_defs/plan9 +25 -0
- polyfile/magic_defs/playdate +57 -0
- polyfile/magic_defs/plus5 +18 -0
- polyfile/magic_defs/pmem +46 -0
- polyfile/magic_defs/polyfile_zip +5 -0
- polyfile/magic_defs/polyml +23 -0
- polyfile/magic_defs/printer +269 -0
- polyfile/magic_defs/project +10 -0
- polyfile/magic_defs/psdbms +14 -0
- polyfile/magic_defs/psl +14 -0
- polyfile/magic_defs/pulsar +13 -0
- polyfile/magic_defs/puzzle +17 -0
- polyfile/magic_defs/pwsafe +14 -0
- polyfile/magic_defs/pyramid +12 -0
- polyfile/magic_defs/python +305 -0
- polyfile/magic_defs/qt +30 -0
- polyfile/magic_defs/revision +66 -0
- polyfile/magic_defs/riff +840 -0
- polyfile/magic_defs/rinex +44 -0
- polyfile/magic_defs/ringdove +45 -0
- polyfile/magic_defs/rpi +52 -0
- polyfile/magic_defs/rpm +45 -0
- polyfile/magic_defs/rpmsg +7 -0
- polyfile/magic_defs/rst +11 -0
- polyfile/magic_defs/rtf +94 -0
- polyfile/magic_defs/ruby +55 -0
- polyfile/magic_defs/rust +21 -0
- polyfile/magic_defs/sc +7 -0
- polyfile/magic_defs/sccs +24 -0
- polyfile/magic_defs/scientific +144 -0
- polyfile/magic_defs/securitycerts +6 -0
- polyfile/magic_defs/selinux +24 -0
- polyfile/magic_defs/sendmail +37 -0
- polyfile/magic_defs/sequent +42 -0
- polyfile/magic_defs/sereal +35 -0
- polyfile/magic_defs/sgi +144 -0
- polyfile/magic_defs/sgml +161 -0
- polyfile/magic_defs/sharc +23 -0
- polyfile/magic_defs/sinclair +40 -0
- polyfile/magic_defs/sisu +18 -0
- polyfile/magic_defs/sketch +6 -0
- polyfile/magic_defs/smalltalk +25 -0
- polyfile/magic_defs/smile +34 -0
- polyfile/magic_defs/sniffer +482 -0
- polyfile/magic_defs/softquad +40 -0
- polyfile/magic_defs/sosi +40 -0
- polyfile/magic_defs/spec +21 -0
- polyfile/magic_defs/spectrum +184 -0
- polyfile/magic_defs/sql +288 -0
- polyfile/magic_defs/ssh +39 -0
- polyfile/magic_defs/ssl +20 -0
- polyfile/magic_defs/statistics +45 -0
- polyfile/magic_defs/subtitle +38 -0
- polyfile/magic_defs/sun +141 -0
- polyfile/magic_defs/svf +5 -0
- polyfile/magic_defs/sylk +36 -0
- polyfile/magic_defs/symbos +42 -0
- polyfile/magic_defs/sysex +429 -0
- polyfile/magic_defs/tcl +29 -0
- polyfile/magic_defs/teapot +6 -0
- polyfile/magic_defs/terminfo +63 -0
- polyfile/magic_defs/tex +141 -0
- polyfile/magic_defs/tgif +7 -0
- polyfile/magic_defs/ti-8x +239 -0
- polyfile/magic_defs/timezone +42 -0
- polyfile/magic_defs/tplink +95 -0
- polyfile/magic_defs/troff +38 -0
- polyfile/magic_defs/tuxedo +8 -0
- polyfile/magic_defs/typeset +8 -0
- polyfile/magic_defs/uf2 +72 -0
- polyfile/magic_defs/unicode +15 -0
- polyfile/magic_defs/unisig +12 -0
- polyfile/magic_defs/unknown +34 -0
- polyfile/magic_defs/usd +21 -0
- polyfile/magic_defs/uterus +16 -0
- polyfile/magic_defs/uuencode +28 -0
- polyfile/magic_defs/vacuum-cleaner +54 -0
- polyfile/magic_defs/varied.out +46 -0
- polyfile/magic_defs/varied.script +21 -0
- polyfile/magic_defs/vax +32 -0
- polyfile/magic_defs/vicar +17 -0
- polyfile/magic_defs/virtual +307 -0
- polyfile/magic_defs/virtutech +12 -0
- polyfile/magic_defs/visx +32 -0
- polyfile/magic_defs/vms +30 -0
- polyfile/magic_defs/vmware +6 -0
- polyfile/magic_defs/vorbis +155 -0
- polyfile/magic_defs/vxl +14 -0
- polyfile/magic_defs/warc +16 -0
- polyfile/magic_defs/weak +16 -0
- polyfile/magic_defs/web +18 -0
- polyfile/magic_defs/webassembly +17 -0
- polyfile/magic_defs/windows +1811 -0
- polyfile/magic_defs/wireless +7 -0
- polyfile/magic_defs/wordprocessors +630 -0
- polyfile/magic_defs/wsdl +23 -0
- polyfile/magic_defs/x68000 +25 -0
- polyfile/magic_defs/xdelta +13 -0
- polyfile/magic_defs/xenix +106 -0
- polyfile/magic_defs/xilinx +58 -0
- polyfile/magic_defs/xo65 +37 -0
- polyfile/magic_defs/xwindows +43 -0
- polyfile/magic_defs/yara +17 -0
- polyfile/magic_defs/zfs +96 -0
- polyfile/magic_defs/zilog +12 -0
- polyfile/magic_defs/zip +126 -0
- polyfile/magic_defs/zyxel +17 -0
- polyfile/nes.py +144 -0
- polyfile/nitf.py +15 -0
- polyfile/pdf.py +1264 -0
- polyfile/pickles.py +45 -0
- polyfile/polyfile.py +409 -0
- polyfile/profiling.py +115 -0
- polyfile/repl.py +624 -0
- polyfile/search.py +310 -0
- polyfile/serialization.py +323 -0
- polyfile/structmatcher.py +46 -0
- polyfile/structs.py +281 -0
- polyfile/templates/download.js +162 -0
- polyfile/templates/hexdump.css +268 -0
- polyfile/templates/hexdump.js +756 -0
- polyfile/templates/jquery-3.4.1.min.js +2 -0
- polyfile/templates/template.html +119 -0
- polyfile/wildcards.py +62 -0
- polyfile/zipmatcher.py +183 -0
- polyfile_weave-0.5.5.dist-info/METADATA +173 -0
- polyfile_weave-0.5.5.dist-info/RECORD +585 -0
- polyfile_weave-0.5.5.dist-info/WHEEL +5 -0
- polyfile_weave-0.5.5.dist-info/entry_points.txt +2 -0
- polyfile_weave-0.5.5.dist-info/licenses/LICENSE +202 -0
- polyfile_weave-0.5.5.dist-info/top_level.txt +2 -0
- polymerge/__init__.py +1 -0
- polymerge/__main__.py +296 -0
- polymerge/cfg.py +127 -0
- polymerge/polymerge.py +227 -0
- polymerge/polytracker.py +190 -0
|
@@ -0,0 +1,1847 @@
|
|
|
1
|
+
# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
|
|
2
|
+
|
|
3
|
+
from pkg_resources import parse_version
|
|
4
|
+
import kaitaistruct
|
|
5
|
+
from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO
|
|
6
|
+
import collections
|
|
7
|
+
from enum import Enum
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
if parse_version(kaitaistruct.__version__) < parse_version('0.9'):
|
|
11
|
+
raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__))
|
|
12
|
+
|
|
13
|
+
class Ttf(KaitaiStruct):
|
|
14
|
+
"""A TrueType font file contains data, in table format, that comprises
|
|
15
|
+
an outline font.
|
|
16
|
+
|
|
17
|
+
.. seealso::
|
|
18
|
+
Source - https://web.archive.org/web/20160410081432/https://www.microsoft.com/typography/tt/ttf_spec/ttch02.doc
|
|
19
|
+
"""
|
|
20
|
+
SEQ_FIELDS = ["offset_table", "directory_table"]
|
|
21
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
22
|
+
self._io = _io
|
|
23
|
+
self._parent = _parent
|
|
24
|
+
self._root = _root if _root else self
|
|
25
|
+
self._debug = collections.defaultdict(dict)
|
|
26
|
+
|
|
27
|
+
def _read(self):
|
|
28
|
+
self._debug['offset_table']['start'] = self._io.pos()
|
|
29
|
+
self.offset_table = Ttf.OffsetTable(self._io, self, self._root)
|
|
30
|
+
self.offset_table._read()
|
|
31
|
+
self._debug['offset_table']['end'] = self._io.pos()
|
|
32
|
+
self._debug['directory_table']['start'] = self._io.pos()
|
|
33
|
+
self.directory_table = [None] * (self.offset_table.num_tables)
|
|
34
|
+
for i in range(self.offset_table.num_tables):
|
|
35
|
+
if not 'arr' in self._debug['directory_table']:
|
|
36
|
+
self._debug['directory_table']['arr'] = []
|
|
37
|
+
self._debug['directory_table']['arr'].append({'start': self._io.pos()})
|
|
38
|
+
_t_directory_table = Ttf.DirTableEntry(self._io, self, self._root)
|
|
39
|
+
_t_directory_table._read()
|
|
40
|
+
self.directory_table[i] = _t_directory_table
|
|
41
|
+
self._debug['directory_table']['arr'][i]['end'] = self._io.pos()
|
|
42
|
+
|
|
43
|
+
self._debug['directory_table']['end'] = self._io.pos()
|
|
44
|
+
|
|
45
|
+
class Post(KaitaiStruct):
|
|
46
|
+
SEQ_FIELDS = ["format", "italic_angle", "underline_position", "underline_thichness", "is_fixed_pitch", "min_mem_type42", "max_mem_type42", "min_mem_type1", "max_mem_type1", "format20"]
|
|
47
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
48
|
+
self._io = _io
|
|
49
|
+
self._parent = _parent
|
|
50
|
+
self._root = _root if _root else self
|
|
51
|
+
self._debug = collections.defaultdict(dict)
|
|
52
|
+
|
|
53
|
+
def _read(self):
|
|
54
|
+
self._debug['format']['start'] = self._io.pos()
|
|
55
|
+
self.format = Ttf.Fixed(self._io, self, self._root)
|
|
56
|
+
self.format._read()
|
|
57
|
+
self._debug['format']['end'] = self._io.pos()
|
|
58
|
+
self._debug['italic_angle']['start'] = self._io.pos()
|
|
59
|
+
self.italic_angle = Ttf.Fixed(self._io, self, self._root)
|
|
60
|
+
self.italic_angle._read()
|
|
61
|
+
self._debug['italic_angle']['end'] = self._io.pos()
|
|
62
|
+
self._debug['underline_position']['start'] = self._io.pos()
|
|
63
|
+
self.underline_position = self._io.read_s2be()
|
|
64
|
+
self._debug['underline_position']['end'] = self._io.pos()
|
|
65
|
+
self._debug['underline_thichness']['start'] = self._io.pos()
|
|
66
|
+
self.underline_thichness = self._io.read_s2be()
|
|
67
|
+
self._debug['underline_thichness']['end'] = self._io.pos()
|
|
68
|
+
self._debug['is_fixed_pitch']['start'] = self._io.pos()
|
|
69
|
+
self.is_fixed_pitch = self._io.read_u4be()
|
|
70
|
+
self._debug['is_fixed_pitch']['end'] = self._io.pos()
|
|
71
|
+
self._debug['min_mem_type42']['start'] = self._io.pos()
|
|
72
|
+
self.min_mem_type42 = self._io.read_u4be()
|
|
73
|
+
self._debug['min_mem_type42']['end'] = self._io.pos()
|
|
74
|
+
self._debug['max_mem_type42']['start'] = self._io.pos()
|
|
75
|
+
self.max_mem_type42 = self._io.read_u4be()
|
|
76
|
+
self._debug['max_mem_type42']['end'] = self._io.pos()
|
|
77
|
+
self._debug['min_mem_type1']['start'] = self._io.pos()
|
|
78
|
+
self.min_mem_type1 = self._io.read_u4be()
|
|
79
|
+
self._debug['min_mem_type1']['end'] = self._io.pos()
|
|
80
|
+
self._debug['max_mem_type1']['start'] = self._io.pos()
|
|
81
|
+
self.max_mem_type1 = self._io.read_u4be()
|
|
82
|
+
self._debug['max_mem_type1']['end'] = self._io.pos()
|
|
83
|
+
if ((self.format.major == 2) and (self.format.minor == 0)) :
|
|
84
|
+
self._debug['format20']['start'] = self._io.pos()
|
|
85
|
+
self.format20 = Ttf.Post.Format20(self._io, self, self._root)
|
|
86
|
+
self.format20._read()
|
|
87
|
+
self._debug['format20']['end'] = self._io.pos()
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class Format20(KaitaiStruct):
|
|
91
|
+
SEQ_FIELDS = ["number_of_glyphs", "glyph_name_index", "glyph_names"]
|
|
92
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
93
|
+
self._io = _io
|
|
94
|
+
self._parent = _parent
|
|
95
|
+
self._root = _root if _root else self
|
|
96
|
+
self._debug = collections.defaultdict(dict)
|
|
97
|
+
|
|
98
|
+
def _read(self):
|
|
99
|
+
self._debug['number_of_glyphs']['start'] = self._io.pos()
|
|
100
|
+
self.number_of_glyphs = self._io.read_u2be()
|
|
101
|
+
self._debug['number_of_glyphs']['end'] = self._io.pos()
|
|
102
|
+
self._debug['glyph_name_index']['start'] = self._io.pos()
|
|
103
|
+
self.glyph_name_index = [None] * (self.number_of_glyphs)
|
|
104
|
+
for i in range(self.number_of_glyphs):
|
|
105
|
+
if not 'arr' in self._debug['glyph_name_index']:
|
|
106
|
+
self._debug['glyph_name_index']['arr'] = []
|
|
107
|
+
self._debug['glyph_name_index']['arr'].append({'start': self._io.pos()})
|
|
108
|
+
self.glyph_name_index[i] = self._io.read_u2be()
|
|
109
|
+
self._debug['glyph_name_index']['arr'][i]['end'] = self._io.pos()
|
|
110
|
+
|
|
111
|
+
self._debug['glyph_name_index']['end'] = self._io.pos()
|
|
112
|
+
self._debug['glyph_names']['start'] = self._io.pos()
|
|
113
|
+
self.glyph_names = []
|
|
114
|
+
i = 0
|
|
115
|
+
while True:
|
|
116
|
+
if not 'arr' in self._debug['glyph_names']:
|
|
117
|
+
self._debug['glyph_names']['arr'] = []
|
|
118
|
+
self._debug['glyph_names']['arr'].append({'start': self._io.pos()})
|
|
119
|
+
_t_glyph_names = Ttf.Post.Format20.PascalString(self._io, self, self._root)
|
|
120
|
+
_t_glyph_names._read()
|
|
121
|
+
_ = _t_glyph_names
|
|
122
|
+
self.glyph_names.append(_)
|
|
123
|
+
self._debug['glyph_names']['arr'][len(self.glyph_names) - 1]['end'] = self._io.pos()
|
|
124
|
+
if ((_.length == 0) or (self._io.is_eof())) :
|
|
125
|
+
break
|
|
126
|
+
i += 1
|
|
127
|
+
self._debug['glyph_names']['end'] = self._io.pos()
|
|
128
|
+
|
|
129
|
+
class PascalString(KaitaiStruct):
|
|
130
|
+
SEQ_FIELDS = ["length", "value"]
|
|
131
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
132
|
+
self._io = _io
|
|
133
|
+
self._parent = _parent
|
|
134
|
+
self._root = _root if _root else self
|
|
135
|
+
self._debug = collections.defaultdict(dict)
|
|
136
|
+
|
|
137
|
+
def _read(self):
|
|
138
|
+
self._debug['length']['start'] = self._io.pos()
|
|
139
|
+
self.length = self._io.read_u1()
|
|
140
|
+
self._debug['length']['end'] = self._io.pos()
|
|
141
|
+
if self.length != 0:
|
|
142
|
+
self._debug['value']['start'] = self._io.pos()
|
|
143
|
+
self.value = (self._io.read_bytes(self.length)).decode(u"ascii")
|
|
144
|
+
self._debug['value']['end'] = self._io.pos()
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
class Name(KaitaiStruct):
|
|
151
|
+
"""Name table is meant to include human-readable string metadata
|
|
152
|
+
that describes font: name of the font, its styles, copyright &
|
|
153
|
+
trademark notices, vendor and designer info, etc.
|
|
154
|
+
|
|
155
|
+
The table includes a list of "name records", each of which
|
|
156
|
+
corresponds to a single metadata entry.
|
|
157
|
+
|
|
158
|
+
.. seealso::
|
|
159
|
+
Source - https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6name.html
|
|
160
|
+
"""
|
|
161
|
+
|
|
162
|
+
class Platforms(Enum):
|
|
163
|
+
unicode = 0
|
|
164
|
+
macintosh = 1
|
|
165
|
+
reserved_2 = 2
|
|
166
|
+
microsoft = 3
|
|
167
|
+
|
|
168
|
+
class Names(Enum):
|
|
169
|
+
copyright = 0
|
|
170
|
+
font_family = 1
|
|
171
|
+
font_subfamily = 2
|
|
172
|
+
unique_subfamily_id = 3
|
|
173
|
+
full_font_name = 4
|
|
174
|
+
name_table_version = 5
|
|
175
|
+
postscript_font_name = 6
|
|
176
|
+
trademark = 7
|
|
177
|
+
manufacturer = 8
|
|
178
|
+
designer = 9
|
|
179
|
+
description = 10
|
|
180
|
+
url_vendor = 11
|
|
181
|
+
url_designer = 12
|
|
182
|
+
license = 13
|
|
183
|
+
url_license = 14
|
|
184
|
+
reserved_15 = 15
|
|
185
|
+
preferred_family = 16
|
|
186
|
+
preferred_subfamily = 17
|
|
187
|
+
compatible_full_name = 18
|
|
188
|
+
sample_text = 19
|
|
189
|
+
SEQ_FIELDS = ["format_selector", "num_name_records", "ofs_strings", "name_records"]
|
|
190
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
191
|
+
self._io = _io
|
|
192
|
+
self._parent = _parent
|
|
193
|
+
self._root = _root if _root else self
|
|
194
|
+
self._debug = collections.defaultdict(dict)
|
|
195
|
+
|
|
196
|
+
def _read(self):
|
|
197
|
+
self._debug['format_selector']['start'] = self._io.pos()
|
|
198
|
+
self.format_selector = self._io.read_u2be()
|
|
199
|
+
self._debug['format_selector']['end'] = self._io.pos()
|
|
200
|
+
self._debug['num_name_records']['start'] = self._io.pos()
|
|
201
|
+
self.num_name_records = self._io.read_u2be()
|
|
202
|
+
self._debug['num_name_records']['end'] = self._io.pos()
|
|
203
|
+
self._debug['ofs_strings']['start'] = self._io.pos()
|
|
204
|
+
self.ofs_strings = self._io.read_u2be()
|
|
205
|
+
self._debug['ofs_strings']['end'] = self._io.pos()
|
|
206
|
+
self._debug['name_records']['start'] = self._io.pos()
|
|
207
|
+
self.name_records = [None] * (self.num_name_records)
|
|
208
|
+
for i in range(self.num_name_records):
|
|
209
|
+
if not 'arr' in self._debug['name_records']:
|
|
210
|
+
self._debug['name_records']['arr'] = []
|
|
211
|
+
self._debug['name_records']['arr'].append({'start': self._io.pos()})
|
|
212
|
+
_t_name_records = Ttf.Name.NameRecord(self._io, self, self._root)
|
|
213
|
+
_t_name_records._read()
|
|
214
|
+
self.name_records[i] = _t_name_records
|
|
215
|
+
self._debug['name_records']['arr'][i]['end'] = self._io.pos()
|
|
216
|
+
|
|
217
|
+
self._debug['name_records']['end'] = self._io.pos()
|
|
218
|
+
|
|
219
|
+
class NameRecord(KaitaiStruct):
|
|
220
|
+
SEQ_FIELDS = ["platform_id", "encoding_id", "language_id", "name_id", "len_str", "ofs_str"]
|
|
221
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
222
|
+
self._io = _io
|
|
223
|
+
self._parent = _parent
|
|
224
|
+
self._root = _root if _root else self
|
|
225
|
+
self._debug = collections.defaultdict(dict)
|
|
226
|
+
|
|
227
|
+
def _read(self):
|
|
228
|
+
self._debug['platform_id']['start'] = self._io.pos()
|
|
229
|
+
self.platform_id = KaitaiStream.resolve_enum(Ttf.Name.Platforms, self._io.read_u2be())
|
|
230
|
+
self._debug['platform_id']['end'] = self._io.pos()
|
|
231
|
+
self._debug['encoding_id']['start'] = self._io.pos()
|
|
232
|
+
self.encoding_id = self._io.read_u2be()
|
|
233
|
+
self._debug['encoding_id']['end'] = self._io.pos()
|
|
234
|
+
self._debug['language_id']['start'] = self._io.pos()
|
|
235
|
+
self.language_id = self._io.read_u2be()
|
|
236
|
+
self._debug['language_id']['end'] = self._io.pos()
|
|
237
|
+
self._debug['name_id']['start'] = self._io.pos()
|
|
238
|
+
self.name_id = KaitaiStream.resolve_enum(Ttf.Name.Names, self._io.read_u2be())
|
|
239
|
+
self._debug['name_id']['end'] = self._io.pos()
|
|
240
|
+
self._debug['len_str']['start'] = self._io.pos()
|
|
241
|
+
self.len_str = self._io.read_u2be()
|
|
242
|
+
self._debug['len_str']['end'] = self._io.pos()
|
|
243
|
+
self._debug['ofs_str']['start'] = self._io.pos()
|
|
244
|
+
self.ofs_str = self._io.read_u2be()
|
|
245
|
+
self._debug['ofs_str']['end'] = self._io.pos()
|
|
246
|
+
|
|
247
|
+
@property
|
|
248
|
+
def ascii_value(self):
|
|
249
|
+
if hasattr(self, '_m_ascii_value'):
|
|
250
|
+
return self._m_ascii_value if hasattr(self, '_m_ascii_value') else None
|
|
251
|
+
|
|
252
|
+
io = self._parent._io
|
|
253
|
+
_pos = io.pos()
|
|
254
|
+
io.seek((self._parent.ofs_strings + self.ofs_str))
|
|
255
|
+
self._debug['_m_ascii_value']['start'] = io.pos()
|
|
256
|
+
self._m_ascii_value = (io.read_bytes(self.len_str)).decode(u"ascii")
|
|
257
|
+
self._debug['_m_ascii_value']['end'] = io.pos()
|
|
258
|
+
io.seek(_pos)
|
|
259
|
+
return self._m_ascii_value if hasattr(self, '_m_ascii_value') else None
|
|
260
|
+
|
|
261
|
+
@property
|
|
262
|
+
def unicode_value(self):
|
|
263
|
+
if hasattr(self, '_m_unicode_value'):
|
|
264
|
+
return self._m_unicode_value if hasattr(self, '_m_unicode_value') else None
|
|
265
|
+
|
|
266
|
+
io = self._parent._io
|
|
267
|
+
_pos = io.pos()
|
|
268
|
+
io.seek((self._parent.ofs_strings + self.ofs_str))
|
|
269
|
+
self._debug['_m_unicode_value']['start'] = io.pos()
|
|
270
|
+
self._m_unicode_value = (io.read_bytes(self.len_str)).decode(u"utf-16be")
|
|
271
|
+
self._debug['_m_unicode_value']['end'] = io.pos()
|
|
272
|
+
io.seek(_pos)
|
|
273
|
+
return self._m_unicode_value if hasattr(self, '_m_unicode_value') else None
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
class Head(KaitaiStruct):
|
|
278
|
+
|
|
279
|
+
class Flags(Enum):
|
|
280
|
+
baseline_at_y0 = 1
|
|
281
|
+
left_sidebearing_at_x0 = 2
|
|
282
|
+
flag_depend_on_point_size = 4
|
|
283
|
+
flag_force_ppem = 8
|
|
284
|
+
flag_may_advance_width = 16
|
|
285
|
+
|
|
286
|
+
class FontDirectionHint(Enum):
|
|
287
|
+
fully_mixed_directional_glyphs = 0
|
|
288
|
+
only_strongly_left_to_right = 1
|
|
289
|
+
strongly_left_to_right_and_neutrals = 2
|
|
290
|
+
SEQ_FIELDS = ["version", "font_revision", "checksum_adjustment", "magic_number", "flags", "units_per_em", "created", "modified", "x_min", "y_min", "x_max", "y_max", "mac_style", "lowest_rec_ppem", "font_direction_hint", "index_to_loc_format", "glyph_data_format"]
|
|
291
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
292
|
+
self._io = _io
|
|
293
|
+
self._parent = _parent
|
|
294
|
+
self._root = _root if _root else self
|
|
295
|
+
self._debug = collections.defaultdict(dict)
|
|
296
|
+
|
|
297
|
+
def _read(self):
|
|
298
|
+
self._debug['version']['start'] = self._io.pos()
|
|
299
|
+
self.version = Ttf.Fixed(self._io, self, self._root)
|
|
300
|
+
self.version._read()
|
|
301
|
+
self._debug['version']['end'] = self._io.pos()
|
|
302
|
+
self._debug['font_revision']['start'] = self._io.pos()
|
|
303
|
+
self.font_revision = Ttf.Fixed(self._io, self, self._root)
|
|
304
|
+
self.font_revision._read()
|
|
305
|
+
self._debug['font_revision']['end'] = self._io.pos()
|
|
306
|
+
self._debug['checksum_adjustment']['start'] = self._io.pos()
|
|
307
|
+
self.checksum_adjustment = self._io.read_u4be()
|
|
308
|
+
self._debug['checksum_adjustment']['end'] = self._io.pos()
|
|
309
|
+
self._debug['magic_number']['start'] = self._io.pos()
|
|
310
|
+
self.magic_number = self._io.read_bytes(4)
|
|
311
|
+
self._debug['magic_number']['end'] = self._io.pos()
|
|
312
|
+
if not self.magic_number == b"\x5F\x0F\x3C\xF5":
|
|
313
|
+
raise kaitaistruct.ValidationNotEqualError(b"\x5F\x0F\x3C\xF5", self.magic_number, self._io, u"/types/head/seq/3")
|
|
314
|
+
self._debug['flags']['start'] = self._io.pos()
|
|
315
|
+
self.flags = KaitaiStream.resolve_enum(Ttf.Head.Flags, self._io.read_u2be())
|
|
316
|
+
self._debug['flags']['end'] = self._io.pos()
|
|
317
|
+
self._debug['units_per_em']['start'] = self._io.pos()
|
|
318
|
+
self.units_per_em = self._io.read_u2be()
|
|
319
|
+
self._debug['units_per_em']['end'] = self._io.pos()
|
|
320
|
+
self._debug['created']['start'] = self._io.pos()
|
|
321
|
+
self.created = self._io.read_u8be()
|
|
322
|
+
self._debug['created']['end'] = self._io.pos()
|
|
323
|
+
self._debug['modified']['start'] = self._io.pos()
|
|
324
|
+
self.modified = self._io.read_u8be()
|
|
325
|
+
self._debug['modified']['end'] = self._io.pos()
|
|
326
|
+
self._debug['x_min']['start'] = self._io.pos()
|
|
327
|
+
self.x_min = self._io.read_s2be()
|
|
328
|
+
self._debug['x_min']['end'] = self._io.pos()
|
|
329
|
+
self._debug['y_min']['start'] = self._io.pos()
|
|
330
|
+
self.y_min = self._io.read_s2be()
|
|
331
|
+
self._debug['y_min']['end'] = self._io.pos()
|
|
332
|
+
self._debug['x_max']['start'] = self._io.pos()
|
|
333
|
+
self.x_max = self._io.read_s2be()
|
|
334
|
+
self._debug['x_max']['end'] = self._io.pos()
|
|
335
|
+
self._debug['y_max']['start'] = self._io.pos()
|
|
336
|
+
self.y_max = self._io.read_s2be()
|
|
337
|
+
self._debug['y_max']['end'] = self._io.pos()
|
|
338
|
+
self._debug['mac_style']['start'] = self._io.pos()
|
|
339
|
+
self.mac_style = self._io.read_u2be()
|
|
340
|
+
self._debug['mac_style']['end'] = self._io.pos()
|
|
341
|
+
self._debug['lowest_rec_ppem']['start'] = self._io.pos()
|
|
342
|
+
self.lowest_rec_ppem = self._io.read_u2be()
|
|
343
|
+
self._debug['lowest_rec_ppem']['end'] = self._io.pos()
|
|
344
|
+
self._debug['font_direction_hint']['start'] = self._io.pos()
|
|
345
|
+
self.font_direction_hint = KaitaiStream.resolve_enum(Ttf.Head.FontDirectionHint, self._io.read_s2be())
|
|
346
|
+
self._debug['font_direction_hint']['end'] = self._io.pos()
|
|
347
|
+
self._debug['index_to_loc_format']['start'] = self._io.pos()
|
|
348
|
+
self.index_to_loc_format = self._io.read_s2be()
|
|
349
|
+
self._debug['index_to_loc_format']['end'] = self._io.pos()
|
|
350
|
+
self._debug['glyph_data_format']['start'] = self._io.pos()
|
|
351
|
+
self.glyph_data_format = self._io.read_s2be()
|
|
352
|
+
self._debug['glyph_data_format']['end'] = self._io.pos()
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
class Prep(KaitaiStruct):
|
|
356
|
+
SEQ_FIELDS = ["instructions"]
|
|
357
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
358
|
+
self._io = _io
|
|
359
|
+
self._parent = _parent
|
|
360
|
+
self._root = _root if _root else self
|
|
361
|
+
self._debug = collections.defaultdict(dict)
|
|
362
|
+
|
|
363
|
+
def _read(self):
|
|
364
|
+
self._debug['instructions']['start'] = self._io.pos()
|
|
365
|
+
self.instructions = self._io.read_bytes_full()
|
|
366
|
+
self._debug['instructions']['end'] = self._io.pos()
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
class Hhea(KaitaiStruct):
|
|
370
|
+
SEQ_FIELDS = ["version", "ascender", "descender", "line_gap", "advance_width_max", "min_left_side_bearing", "min_right_side_bearing", "x_max_extend", "caret_slope_rise", "caret_slope_run", "reserved", "metric_data_format", "number_of_hmetrics"]
|
|
371
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
372
|
+
self._io = _io
|
|
373
|
+
self._parent = _parent
|
|
374
|
+
self._root = _root if _root else self
|
|
375
|
+
self._debug = collections.defaultdict(dict)
|
|
376
|
+
|
|
377
|
+
def _read(self):
|
|
378
|
+
self._debug['version']['start'] = self._io.pos()
|
|
379
|
+
self.version = Ttf.Fixed(self._io, self, self._root)
|
|
380
|
+
self.version._read()
|
|
381
|
+
self._debug['version']['end'] = self._io.pos()
|
|
382
|
+
self._debug['ascender']['start'] = self._io.pos()
|
|
383
|
+
self.ascender = self._io.read_s2be()
|
|
384
|
+
self._debug['ascender']['end'] = self._io.pos()
|
|
385
|
+
self._debug['descender']['start'] = self._io.pos()
|
|
386
|
+
self.descender = self._io.read_s2be()
|
|
387
|
+
self._debug['descender']['end'] = self._io.pos()
|
|
388
|
+
self._debug['line_gap']['start'] = self._io.pos()
|
|
389
|
+
self.line_gap = self._io.read_s2be()
|
|
390
|
+
self._debug['line_gap']['end'] = self._io.pos()
|
|
391
|
+
self._debug['advance_width_max']['start'] = self._io.pos()
|
|
392
|
+
self.advance_width_max = self._io.read_u2be()
|
|
393
|
+
self._debug['advance_width_max']['end'] = self._io.pos()
|
|
394
|
+
self._debug['min_left_side_bearing']['start'] = self._io.pos()
|
|
395
|
+
self.min_left_side_bearing = self._io.read_s2be()
|
|
396
|
+
self._debug['min_left_side_bearing']['end'] = self._io.pos()
|
|
397
|
+
self._debug['min_right_side_bearing']['start'] = self._io.pos()
|
|
398
|
+
self.min_right_side_bearing = self._io.read_s2be()
|
|
399
|
+
self._debug['min_right_side_bearing']['end'] = self._io.pos()
|
|
400
|
+
self._debug['x_max_extend']['start'] = self._io.pos()
|
|
401
|
+
self.x_max_extend = self._io.read_s2be()
|
|
402
|
+
self._debug['x_max_extend']['end'] = self._io.pos()
|
|
403
|
+
self._debug['caret_slope_rise']['start'] = self._io.pos()
|
|
404
|
+
self.caret_slope_rise = self._io.read_s2be()
|
|
405
|
+
self._debug['caret_slope_rise']['end'] = self._io.pos()
|
|
406
|
+
self._debug['caret_slope_run']['start'] = self._io.pos()
|
|
407
|
+
self.caret_slope_run = self._io.read_s2be()
|
|
408
|
+
self._debug['caret_slope_run']['end'] = self._io.pos()
|
|
409
|
+
self._debug['reserved']['start'] = self._io.pos()
|
|
410
|
+
self.reserved = self._io.read_bytes(10)
|
|
411
|
+
self._debug['reserved']['end'] = self._io.pos()
|
|
412
|
+
if not self.reserved == b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00":
|
|
413
|
+
raise kaitaistruct.ValidationNotEqualError(b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", self.reserved, self._io, u"/types/hhea/seq/10")
|
|
414
|
+
self._debug['metric_data_format']['start'] = self._io.pos()
|
|
415
|
+
self.metric_data_format = self._io.read_s2be()
|
|
416
|
+
self._debug['metric_data_format']['end'] = self._io.pos()
|
|
417
|
+
self._debug['number_of_hmetrics']['start'] = self._io.pos()
|
|
418
|
+
self.number_of_hmetrics = self._io.read_u2be()
|
|
419
|
+
self._debug['number_of_hmetrics']['end'] = self._io.pos()
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
class Fpgm(KaitaiStruct):
|
|
423
|
+
SEQ_FIELDS = ["instructions"]
|
|
424
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
425
|
+
self._io = _io
|
|
426
|
+
self._parent = _parent
|
|
427
|
+
self._root = _root if _root else self
|
|
428
|
+
self._debug = collections.defaultdict(dict)
|
|
429
|
+
|
|
430
|
+
def _read(self):
|
|
431
|
+
self._debug['instructions']['start'] = self._io.pos()
|
|
432
|
+
self.instructions = self._io.read_bytes_full()
|
|
433
|
+
self._debug['instructions']['end'] = self._io.pos()
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
class Kern(KaitaiStruct):
|
|
437
|
+
SEQ_FIELDS = ["version", "subtable_count", "subtables"]
|
|
438
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
439
|
+
self._io = _io
|
|
440
|
+
self._parent = _parent
|
|
441
|
+
self._root = _root if _root else self
|
|
442
|
+
self._debug = collections.defaultdict(dict)
|
|
443
|
+
|
|
444
|
+
def _read(self):
|
|
445
|
+
self._debug['version']['start'] = self._io.pos()
|
|
446
|
+
self.version = self._io.read_u2be()
|
|
447
|
+
self._debug['version']['end'] = self._io.pos()
|
|
448
|
+
self._debug['subtable_count']['start'] = self._io.pos()
|
|
449
|
+
self.subtable_count = self._io.read_u2be()
|
|
450
|
+
self._debug['subtable_count']['end'] = self._io.pos()
|
|
451
|
+
self._debug['subtables']['start'] = self._io.pos()
|
|
452
|
+
self.subtables = [None] * (self.subtable_count)
|
|
453
|
+
for i in range(self.subtable_count):
|
|
454
|
+
if not 'arr' in self._debug['subtables']:
|
|
455
|
+
self._debug['subtables']['arr'] = []
|
|
456
|
+
self._debug['subtables']['arr'].append({'start': self._io.pos()})
|
|
457
|
+
_t_subtables = Ttf.Kern.Subtable(self._io, self, self._root)
|
|
458
|
+
_t_subtables._read()
|
|
459
|
+
self.subtables[i] = _t_subtables
|
|
460
|
+
self._debug['subtables']['arr'][i]['end'] = self._io.pos()
|
|
461
|
+
|
|
462
|
+
self._debug['subtables']['end'] = self._io.pos()
|
|
463
|
+
|
|
464
|
+
class Subtable(KaitaiStruct):
|
|
465
|
+
SEQ_FIELDS = ["version", "length", "format", "reserved", "is_override", "is_cross_stream", "is_minimum", "is_horizontal", "format0"]
|
|
466
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
467
|
+
self._io = _io
|
|
468
|
+
self._parent = _parent
|
|
469
|
+
self._root = _root if _root else self
|
|
470
|
+
self._debug = collections.defaultdict(dict)
|
|
471
|
+
|
|
472
|
+
def _read(self):
|
|
473
|
+
self._debug['version']['start'] = self._io.pos()
|
|
474
|
+
self.version = self._io.read_u2be()
|
|
475
|
+
self._debug['version']['end'] = self._io.pos()
|
|
476
|
+
self._debug['length']['start'] = self._io.pos()
|
|
477
|
+
self.length = self._io.read_u2be()
|
|
478
|
+
self._debug['length']['end'] = self._io.pos()
|
|
479
|
+
self._debug['format']['start'] = self._io.pos()
|
|
480
|
+
self.format = self._io.read_u1()
|
|
481
|
+
self._debug['format']['end'] = self._io.pos()
|
|
482
|
+
self._debug['reserved']['start'] = self._io.pos()
|
|
483
|
+
self.reserved = self._io.read_bits_int_be(4)
|
|
484
|
+
self._debug['reserved']['end'] = self._io.pos()
|
|
485
|
+
self._debug['is_override']['start'] = self._io.pos()
|
|
486
|
+
self.is_override = self._io.read_bits_int_be(1) != 0
|
|
487
|
+
self._debug['is_override']['end'] = self._io.pos()
|
|
488
|
+
self._debug['is_cross_stream']['start'] = self._io.pos()
|
|
489
|
+
self.is_cross_stream = self._io.read_bits_int_be(1) != 0
|
|
490
|
+
self._debug['is_cross_stream']['end'] = self._io.pos()
|
|
491
|
+
self._debug['is_minimum']['start'] = self._io.pos()
|
|
492
|
+
self.is_minimum = self._io.read_bits_int_be(1) != 0
|
|
493
|
+
self._debug['is_minimum']['end'] = self._io.pos()
|
|
494
|
+
self._debug['is_horizontal']['start'] = self._io.pos()
|
|
495
|
+
self.is_horizontal = self._io.read_bits_int_be(1) != 0
|
|
496
|
+
self._debug['is_horizontal']['end'] = self._io.pos()
|
|
497
|
+
self._io.align_to_byte()
|
|
498
|
+
if self.format == 0:
|
|
499
|
+
self._debug['format0']['start'] = self._io.pos()
|
|
500
|
+
self.format0 = Ttf.Kern.Subtable.Format0(self._io, self, self._root)
|
|
501
|
+
self.format0._read()
|
|
502
|
+
self._debug['format0']['end'] = self._io.pos()
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
class Format0(KaitaiStruct):
|
|
506
|
+
SEQ_FIELDS = ["pair_count", "search_range", "entry_selector", "range_shift", "kerning_pairs"]
|
|
507
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
508
|
+
self._io = _io
|
|
509
|
+
self._parent = _parent
|
|
510
|
+
self._root = _root if _root else self
|
|
511
|
+
self._debug = collections.defaultdict(dict)
|
|
512
|
+
|
|
513
|
+
def _read(self):
|
|
514
|
+
self._debug['pair_count']['start'] = self._io.pos()
|
|
515
|
+
self.pair_count = self._io.read_u2be()
|
|
516
|
+
self._debug['pair_count']['end'] = self._io.pos()
|
|
517
|
+
self._debug['search_range']['start'] = self._io.pos()
|
|
518
|
+
self.search_range = self._io.read_u2be()
|
|
519
|
+
self._debug['search_range']['end'] = self._io.pos()
|
|
520
|
+
self._debug['entry_selector']['start'] = self._io.pos()
|
|
521
|
+
self.entry_selector = self._io.read_u2be()
|
|
522
|
+
self._debug['entry_selector']['end'] = self._io.pos()
|
|
523
|
+
self._debug['range_shift']['start'] = self._io.pos()
|
|
524
|
+
self.range_shift = self._io.read_u2be()
|
|
525
|
+
self._debug['range_shift']['end'] = self._io.pos()
|
|
526
|
+
self._debug['kerning_pairs']['start'] = self._io.pos()
|
|
527
|
+
self.kerning_pairs = [None] * (self.pair_count)
|
|
528
|
+
for i in range(self.pair_count):
|
|
529
|
+
if not 'arr' in self._debug['kerning_pairs']:
|
|
530
|
+
self._debug['kerning_pairs']['arr'] = []
|
|
531
|
+
self._debug['kerning_pairs']['arr'].append({'start': self._io.pos()})
|
|
532
|
+
_t_kerning_pairs = Ttf.Kern.Subtable.Format0.KerningPair(self._io, self, self._root)
|
|
533
|
+
_t_kerning_pairs._read()
|
|
534
|
+
self.kerning_pairs[i] = _t_kerning_pairs
|
|
535
|
+
self._debug['kerning_pairs']['arr'][i]['end'] = self._io.pos()
|
|
536
|
+
|
|
537
|
+
self._debug['kerning_pairs']['end'] = self._io.pos()
|
|
538
|
+
|
|
539
|
+
class KerningPair(KaitaiStruct):
|
|
540
|
+
SEQ_FIELDS = ["left", "right", "value"]
|
|
541
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
542
|
+
self._io = _io
|
|
543
|
+
self._parent = _parent
|
|
544
|
+
self._root = _root if _root else self
|
|
545
|
+
self._debug = collections.defaultdict(dict)
|
|
546
|
+
|
|
547
|
+
def _read(self):
|
|
548
|
+
self._debug['left']['start'] = self._io.pos()
|
|
549
|
+
self.left = self._io.read_u2be()
|
|
550
|
+
self._debug['left']['end'] = self._io.pos()
|
|
551
|
+
self._debug['right']['start'] = self._io.pos()
|
|
552
|
+
self.right = self._io.read_u2be()
|
|
553
|
+
self._debug['right']['end'] = self._io.pos()
|
|
554
|
+
self._debug['value']['start'] = self._io.pos()
|
|
555
|
+
self.value = self._io.read_s2be()
|
|
556
|
+
self._debug['value']['end'] = self._io.pos()
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
class DirTableEntry(KaitaiStruct):
|
|
563
|
+
SEQ_FIELDS = ["tag", "checksum", "offset", "length"]
|
|
564
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
565
|
+
self._io = _io
|
|
566
|
+
self._parent = _parent
|
|
567
|
+
self._root = _root if _root else self
|
|
568
|
+
self._debug = collections.defaultdict(dict)
|
|
569
|
+
|
|
570
|
+
def _read(self):
|
|
571
|
+
self._debug['tag']['start'] = self._io.pos()
|
|
572
|
+
self.tag = (self._io.read_bytes(4)).decode(u"ascii")
|
|
573
|
+
self._debug['tag']['end'] = self._io.pos()
|
|
574
|
+
self._debug['checksum']['start'] = self._io.pos()
|
|
575
|
+
self.checksum = self._io.read_u4be()
|
|
576
|
+
self._debug['checksum']['end'] = self._io.pos()
|
|
577
|
+
self._debug['offset']['start'] = self._io.pos()
|
|
578
|
+
self.offset = self._io.read_u4be()
|
|
579
|
+
self._debug['offset']['end'] = self._io.pos()
|
|
580
|
+
self._debug['length']['start'] = self._io.pos()
|
|
581
|
+
self.length = self._io.read_u4be()
|
|
582
|
+
self._debug['length']['end'] = self._io.pos()
|
|
583
|
+
|
|
584
|
+
@property
|
|
585
|
+
def value(self):
|
|
586
|
+
if hasattr(self, '_m_value'):
|
|
587
|
+
return self._m_value if hasattr(self, '_m_value') else None
|
|
588
|
+
|
|
589
|
+
io = self._root._io
|
|
590
|
+
_pos = io.pos()
|
|
591
|
+
io.seek(self.offset)
|
|
592
|
+
self._debug['_m_value']['start'] = io.pos()
|
|
593
|
+
_on = self.tag
|
|
594
|
+
if _on == u"head":
|
|
595
|
+
self._raw__m_value = io.read_bytes(self.length)
|
|
596
|
+
_io__raw__m_value = KaitaiStream(BytesIO(self._raw__m_value))
|
|
597
|
+
self._m_value = Ttf.Head(_io__raw__m_value, self, self._root)
|
|
598
|
+
self._m_value._read()
|
|
599
|
+
elif _on == u"cvt ":
|
|
600
|
+
self._raw__m_value = io.read_bytes(self.length)
|
|
601
|
+
_io__raw__m_value = KaitaiStream(BytesIO(self._raw__m_value))
|
|
602
|
+
self._m_value = Ttf.Cvt(_io__raw__m_value, self, self._root)
|
|
603
|
+
self._m_value._read()
|
|
604
|
+
elif _on == u"prep":
|
|
605
|
+
self._raw__m_value = io.read_bytes(self.length)
|
|
606
|
+
_io__raw__m_value = KaitaiStream(BytesIO(self._raw__m_value))
|
|
607
|
+
self._m_value = Ttf.Prep(_io__raw__m_value, self, self._root)
|
|
608
|
+
self._m_value._read()
|
|
609
|
+
elif _on == u"kern":
|
|
610
|
+
self._raw__m_value = io.read_bytes(self.length)
|
|
611
|
+
_io__raw__m_value = KaitaiStream(BytesIO(self._raw__m_value))
|
|
612
|
+
self._m_value = Ttf.Kern(_io__raw__m_value, self, self._root)
|
|
613
|
+
self._m_value._read()
|
|
614
|
+
elif _on == u"hhea":
|
|
615
|
+
self._raw__m_value = io.read_bytes(self.length)
|
|
616
|
+
_io__raw__m_value = KaitaiStream(BytesIO(self._raw__m_value))
|
|
617
|
+
self._m_value = Ttf.Hhea(_io__raw__m_value, self, self._root)
|
|
618
|
+
self._m_value._read()
|
|
619
|
+
elif _on == u"post":
|
|
620
|
+
self._raw__m_value = io.read_bytes(self.length)
|
|
621
|
+
_io__raw__m_value = KaitaiStream(BytesIO(self._raw__m_value))
|
|
622
|
+
self._m_value = Ttf.Post(_io__raw__m_value, self, self._root)
|
|
623
|
+
self._m_value._read()
|
|
624
|
+
elif _on == u"OS/2":
|
|
625
|
+
self._raw__m_value = io.read_bytes(self.length)
|
|
626
|
+
_io__raw__m_value = KaitaiStream(BytesIO(self._raw__m_value))
|
|
627
|
+
self._m_value = Ttf.Os2(_io__raw__m_value, self, self._root)
|
|
628
|
+
self._m_value._read()
|
|
629
|
+
elif _on == u"name":
|
|
630
|
+
self._raw__m_value = io.read_bytes(self.length)
|
|
631
|
+
_io__raw__m_value = KaitaiStream(BytesIO(self._raw__m_value))
|
|
632
|
+
self._m_value = Ttf.Name(_io__raw__m_value, self, self._root)
|
|
633
|
+
self._m_value._read()
|
|
634
|
+
elif _on == u"maxp":
|
|
635
|
+
self._raw__m_value = io.read_bytes(self.length)
|
|
636
|
+
_io__raw__m_value = KaitaiStream(BytesIO(self._raw__m_value))
|
|
637
|
+
self._m_value = Ttf.Maxp(_io__raw__m_value, self, self._root)
|
|
638
|
+
self._m_value._read()
|
|
639
|
+
elif _on == u"glyf":
|
|
640
|
+
self._raw__m_value = io.read_bytes(self.length)
|
|
641
|
+
_io__raw__m_value = KaitaiStream(BytesIO(self._raw__m_value))
|
|
642
|
+
self._m_value = Ttf.Glyf(_io__raw__m_value, self, self._root)
|
|
643
|
+
self._m_value._read()
|
|
644
|
+
elif _on == u"fpgm":
|
|
645
|
+
self._raw__m_value = io.read_bytes(self.length)
|
|
646
|
+
_io__raw__m_value = KaitaiStream(BytesIO(self._raw__m_value))
|
|
647
|
+
self._m_value = Ttf.Fpgm(_io__raw__m_value, self, self._root)
|
|
648
|
+
self._m_value._read()
|
|
649
|
+
elif _on == u"cmap":
|
|
650
|
+
self._raw__m_value = io.read_bytes(self.length)
|
|
651
|
+
_io__raw__m_value = KaitaiStream(BytesIO(self._raw__m_value))
|
|
652
|
+
self._m_value = Ttf.Cmap(_io__raw__m_value, self, self._root)
|
|
653
|
+
self._m_value._read()
|
|
654
|
+
else:
|
|
655
|
+
self._m_value = io.read_bytes(self.length)
|
|
656
|
+
self._debug['_m_value']['end'] = io.pos()
|
|
657
|
+
io.seek(_pos)
|
|
658
|
+
return self._m_value if hasattr(self, '_m_value') else None
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
class Os2(KaitaiStruct):
|
|
662
|
+
"""The OS/2 table consists of a set of metrics that are required by Windows and OS/2."""
|
|
663
|
+
|
|
664
|
+
class WeightClass(Enum):
|
|
665
|
+
thin = 100
|
|
666
|
+
extra_light = 200
|
|
667
|
+
light = 300
|
|
668
|
+
normal = 400
|
|
669
|
+
medium = 500
|
|
670
|
+
semi_bold = 600
|
|
671
|
+
bold = 700
|
|
672
|
+
extra_bold = 800
|
|
673
|
+
black = 900
|
|
674
|
+
|
|
675
|
+
class WidthClass(Enum):
|
|
676
|
+
ultra_condensed = 1
|
|
677
|
+
extra_condensed = 2
|
|
678
|
+
condensed = 3
|
|
679
|
+
semi_condensed = 4
|
|
680
|
+
normal = 5
|
|
681
|
+
semi_expanded = 6
|
|
682
|
+
expanded = 7
|
|
683
|
+
extra_expanded = 8
|
|
684
|
+
ultra_expanded = 9
|
|
685
|
+
|
|
686
|
+
class FsType(Enum):
|
|
687
|
+
restricted_license_embedding = 2
|
|
688
|
+
preview_and_print_embedding = 4
|
|
689
|
+
editable_embedding = 8
|
|
690
|
+
|
|
691
|
+
class FsSelection(Enum):
|
|
692
|
+
italic = 1
|
|
693
|
+
underscore = 2
|
|
694
|
+
negative = 4
|
|
695
|
+
outlined = 8
|
|
696
|
+
strikeout = 16
|
|
697
|
+
bold = 32
|
|
698
|
+
regular = 64
|
|
699
|
+
SEQ_FIELDS = ["version", "x_avg_char_width", "weight_class", "width_class", "fs_type", "y_subscript_x_size", "y_subscript_y_size", "y_subscript_x_offset", "y_subscript_y_offset", "y_superscript_x_size", "y_superscript_y_size", "y_superscript_x_offset", "y_superscript_y_offset", "y_strikeout_size", "y_strikeout_position", "s_family_class", "panose", "unicode_range", "ach_vend_id", "selection", "first_char_index", "last_char_index", "typo_ascender", "typo_descender", "typo_line_gap", "win_ascent", "win_descent", "code_page_range"]
|
|
700
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
701
|
+
self._io = _io
|
|
702
|
+
self._parent = _parent
|
|
703
|
+
self._root = _root if _root else self
|
|
704
|
+
self._debug = collections.defaultdict(dict)
|
|
705
|
+
|
|
706
|
+
def _read(self):
|
|
707
|
+
self._debug['version']['start'] = self._io.pos()
|
|
708
|
+
self.version = self._io.read_u2be()
|
|
709
|
+
self._debug['version']['end'] = self._io.pos()
|
|
710
|
+
self._debug['x_avg_char_width']['start'] = self._io.pos()
|
|
711
|
+
self.x_avg_char_width = self._io.read_s2be()
|
|
712
|
+
self._debug['x_avg_char_width']['end'] = self._io.pos()
|
|
713
|
+
self._debug['weight_class']['start'] = self._io.pos()
|
|
714
|
+
self.weight_class = KaitaiStream.resolve_enum(Ttf.Os2.WeightClass, self._io.read_u2be())
|
|
715
|
+
self._debug['weight_class']['end'] = self._io.pos()
|
|
716
|
+
self._debug['width_class']['start'] = self._io.pos()
|
|
717
|
+
self.width_class = KaitaiStream.resolve_enum(Ttf.Os2.WidthClass, self._io.read_u2be())
|
|
718
|
+
self._debug['width_class']['end'] = self._io.pos()
|
|
719
|
+
self._debug['fs_type']['start'] = self._io.pos()
|
|
720
|
+
self.fs_type = KaitaiStream.resolve_enum(Ttf.Os2.FsType, self._io.read_s2be())
|
|
721
|
+
self._debug['fs_type']['end'] = self._io.pos()
|
|
722
|
+
self._debug['y_subscript_x_size']['start'] = self._io.pos()
|
|
723
|
+
self.y_subscript_x_size = self._io.read_s2be()
|
|
724
|
+
self._debug['y_subscript_x_size']['end'] = self._io.pos()
|
|
725
|
+
self._debug['y_subscript_y_size']['start'] = self._io.pos()
|
|
726
|
+
self.y_subscript_y_size = self._io.read_s2be()
|
|
727
|
+
self._debug['y_subscript_y_size']['end'] = self._io.pos()
|
|
728
|
+
self._debug['y_subscript_x_offset']['start'] = self._io.pos()
|
|
729
|
+
self.y_subscript_x_offset = self._io.read_s2be()
|
|
730
|
+
self._debug['y_subscript_x_offset']['end'] = self._io.pos()
|
|
731
|
+
self._debug['y_subscript_y_offset']['start'] = self._io.pos()
|
|
732
|
+
self.y_subscript_y_offset = self._io.read_s2be()
|
|
733
|
+
self._debug['y_subscript_y_offset']['end'] = self._io.pos()
|
|
734
|
+
self._debug['y_superscript_x_size']['start'] = self._io.pos()
|
|
735
|
+
self.y_superscript_x_size = self._io.read_s2be()
|
|
736
|
+
self._debug['y_superscript_x_size']['end'] = self._io.pos()
|
|
737
|
+
self._debug['y_superscript_y_size']['start'] = self._io.pos()
|
|
738
|
+
self.y_superscript_y_size = self._io.read_s2be()
|
|
739
|
+
self._debug['y_superscript_y_size']['end'] = self._io.pos()
|
|
740
|
+
self._debug['y_superscript_x_offset']['start'] = self._io.pos()
|
|
741
|
+
self.y_superscript_x_offset = self._io.read_s2be()
|
|
742
|
+
self._debug['y_superscript_x_offset']['end'] = self._io.pos()
|
|
743
|
+
self._debug['y_superscript_y_offset']['start'] = self._io.pos()
|
|
744
|
+
self.y_superscript_y_offset = self._io.read_s2be()
|
|
745
|
+
self._debug['y_superscript_y_offset']['end'] = self._io.pos()
|
|
746
|
+
self._debug['y_strikeout_size']['start'] = self._io.pos()
|
|
747
|
+
self.y_strikeout_size = self._io.read_s2be()
|
|
748
|
+
self._debug['y_strikeout_size']['end'] = self._io.pos()
|
|
749
|
+
self._debug['y_strikeout_position']['start'] = self._io.pos()
|
|
750
|
+
self.y_strikeout_position = self._io.read_s2be()
|
|
751
|
+
self._debug['y_strikeout_position']['end'] = self._io.pos()
|
|
752
|
+
self._debug['s_family_class']['start'] = self._io.pos()
|
|
753
|
+
self.s_family_class = self._io.read_s2be()
|
|
754
|
+
self._debug['s_family_class']['end'] = self._io.pos()
|
|
755
|
+
self._debug['panose']['start'] = self._io.pos()
|
|
756
|
+
self.panose = Ttf.Os2.Panose(self._io, self, self._root)
|
|
757
|
+
self.panose._read()
|
|
758
|
+
self._debug['panose']['end'] = self._io.pos()
|
|
759
|
+
self._debug['unicode_range']['start'] = self._io.pos()
|
|
760
|
+
self.unicode_range = Ttf.Os2.UnicodeRange(self._io, self, self._root)
|
|
761
|
+
self.unicode_range._read()
|
|
762
|
+
self._debug['unicode_range']['end'] = self._io.pos()
|
|
763
|
+
self._debug['ach_vend_id']['start'] = self._io.pos()
|
|
764
|
+
self.ach_vend_id = (self._io.read_bytes(4)).decode(u"ascii")
|
|
765
|
+
self._debug['ach_vend_id']['end'] = self._io.pos()
|
|
766
|
+
self._debug['selection']['start'] = self._io.pos()
|
|
767
|
+
self.selection = KaitaiStream.resolve_enum(Ttf.Os2.FsSelection, self._io.read_u2be())
|
|
768
|
+
self._debug['selection']['end'] = self._io.pos()
|
|
769
|
+
self._debug['first_char_index']['start'] = self._io.pos()
|
|
770
|
+
self.first_char_index = self._io.read_u2be()
|
|
771
|
+
self._debug['first_char_index']['end'] = self._io.pos()
|
|
772
|
+
self._debug['last_char_index']['start'] = self._io.pos()
|
|
773
|
+
self.last_char_index = self._io.read_u2be()
|
|
774
|
+
self._debug['last_char_index']['end'] = self._io.pos()
|
|
775
|
+
self._debug['typo_ascender']['start'] = self._io.pos()
|
|
776
|
+
self.typo_ascender = self._io.read_s2be()
|
|
777
|
+
self._debug['typo_ascender']['end'] = self._io.pos()
|
|
778
|
+
self._debug['typo_descender']['start'] = self._io.pos()
|
|
779
|
+
self.typo_descender = self._io.read_s2be()
|
|
780
|
+
self._debug['typo_descender']['end'] = self._io.pos()
|
|
781
|
+
self._debug['typo_line_gap']['start'] = self._io.pos()
|
|
782
|
+
self.typo_line_gap = self._io.read_s2be()
|
|
783
|
+
self._debug['typo_line_gap']['end'] = self._io.pos()
|
|
784
|
+
self._debug['win_ascent']['start'] = self._io.pos()
|
|
785
|
+
self.win_ascent = self._io.read_u2be()
|
|
786
|
+
self._debug['win_ascent']['end'] = self._io.pos()
|
|
787
|
+
self._debug['win_descent']['start'] = self._io.pos()
|
|
788
|
+
self.win_descent = self._io.read_u2be()
|
|
789
|
+
self._debug['win_descent']['end'] = self._io.pos()
|
|
790
|
+
self._debug['code_page_range']['start'] = self._io.pos()
|
|
791
|
+
self.code_page_range = Ttf.Os2.CodePageRange(self._io, self, self._root)
|
|
792
|
+
self.code_page_range._read()
|
|
793
|
+
self._debug['code_page_range']['end'] = self._io.pos()
|
|
794
|
+
|
|
795
|
+
class Panose(KaitaiStruct):
|
|
796
|
+
|
|
797
|
+
class Weight(Enum):
|
|
798
|
+
any = 0
|
|
799
|
+
no_fit = 1
|
|
800
|
+
very_light = 2
|
|
801
|
+
light = 3
|
|
802
|
+
thin = 4
|
|
803
|
+
book = 5
|
|
804
|
+
medium = 6
|
|
805
|
+
demi = 7
|
|
806
|
+
bold = 8
|
|
807
|
+
heavy = 9
|
|
808
|
+
black = 10
|
|
809
|
+
nord = 11
|
|
810
|
+
|
|
811
|
+
class Proportion(Enum):
|
|
812
|
+
any = 0
|
|
813
|
+
no_fit = 1
|
|
814
|
+
old_style = 2
|
|
815
|
+
modern = 3
|
|
816
|
+
even_width = 4
|
|
817
|
+
expanded = 5
|
|
818
|
+
condensed = 6
|
|
819
|
+
very_expanded = 7
|
|
820
|
+
very_condensed = 8
|
|
821
|
+
monospaced = 9
|
|
822
|
+
|
|
823
|
+
class FamilyKind(Enum):
|
|
824
|
+
any = 0
|
|
825
|
+
no_fit = 1
|
|
826
|
+
text_and_display = 2
|
|
827
|
+
script = 3
|
|
828
|
+
decorative = 4
|
|
829
|
+
pictorial = 5
|
|
830
|
+
|
|
831
|
+
class LetterForm(Enum):
|
|
832
|
+
any = 0
|
|
833
|
+
no_fit = 1
|
|
834
|
+
normal_contact = 2
|
|
835
|
+
normal_weighted = 3
|
|
836
|
+
normal_boxed = 4
|
|
837
|
+
normal_flattened = 5
|
|
838
|
+
normal_rounded = 6
|
|
839
|
+
normal_off_center = 7
|
|
840
|
+
normal_square = 8
|
|
841
|
+
oblique_contact = 9
|
|
842
|
+
oblique_weighted = 10
|
|
843
|
+
oblique_boxed = 11
|
|
844
|
+
oblique_flattened = 12
|
|
845
|
+
oblique_rounded = 13
|
|
846
|
+
oblique_off_center = 14
|
|
847
|
+
oblique_square = 15
|
|
848
|
+
|
|
849
|
+
class SerifStyle(Enum):
|
|
850
|
+
any = 0
|
|
851
|
+
no_fit = 1
|
|
852
|
+
cove = 2
|
|
853
|
+
obtuse_cove = 3
|
|
854
|
+
square_cove = 4
|
|
855
|
+
obtuse_square_cove = 5
|
|
856
|
+
square = 6
|
|
857
|
+
thin = 7
|
|
858
|
+
bone = 8
|
|
859
|
+
exaggerated = 9
|
|
860
|
+
triangle = 10
|
|
861
|
+
normal_sans = 11
|
|
862
|
+
obtuse_sans = 12
|
|
863
|
+
perp_sans = 13
|
|
864
|
+
flared = 14
|
|
865
|
+
rounded = 15
|
|
866
|
+
|
|
867
|
+
class XHeight(Enum):
|
|
868
|
+
any = 0
|
|
869
|
+
no_fit = 1
|
|
870
|
+
constant_small = 2
|
|
871
|
+
constant_standard = 3
|
|
872
|
+
constant_large = 4
|
|
873
|
+
ducking_small = 5
|
|
874
|
+
ducking_standard = 6
|
|
875
|
+
ducking_large = 7
|
|
876
|
+
|
|
877
|
+
class ArmStyle(Enum):
|
|
878
|
+
any = 0
|
|
879
|
+
no_fit = 1
|
|
880
|
+
straight_arms_horizontal = 2
|
|
881
|
+
straight_arms_wedge = 3
|
|
882
|
+
straight_arms_vertical = 4
|
|
883
|
+
straight_arms_single_serif = 5
|
|
884
|
+
straight_arms_double_serif = 6
|
|
885
|
+
non_straight_arms_horizontal = 7
|
|
886
|
+
non_straight_arms_wedge = 8
|
|
887
|
+
non_straight_arms_vertical = 9
|
|
888
|
+
non_straight_arms_single_serif = 10
|
|
889
|
+
non_straight_arms_double_serif = 11
|
|
890
|
+
|
|
891
|
+
class StrokeVariation(Enum):
|
|
892
|
+
any = 0
|
|
893
|
+
no_fit = 1
|
|
894
|
+
gradual_diagonal = 2
|
|
895
|
+
gradual_transitional = 3
|
|
896
|
+
gradual_vertical = 4
|
|
897
|
+
gradual_horizontal = 5
|
|
898
|
+
rapid_vertical = 6
|
|
899
|
+
rapid_horizontal = 7
|
|
900
|
+
instant_vertical = 8
|
|
901
|
+
|
|
902
|
+
class Contrast(Enum):
|
|
903
|
+
any = 0
|
|
904
|
+
no_fit = 1
|
|
905
|
+
none = 2
|
|
906
|
+
very_low = 3
|
|
907
|
+
low = 4
|
|
908
|
+
medium_low = 5
|
|
909
|
+
medium = 6
|
|
910
|
+
medium_high = 7
|
|
911
|
+
high = 8
|
|
912
|
+
very_high = 9
|
|
913
|
+
|
|
914
|
+
class Midline(Enum):
|
|
915
|
+
any = 0
|
|
916
|
+
no_fit = 1
|
|
917
|
+
standard_trimmed = 2
|
|
918
|
+
standard_pointed = 3
|
|
919
|
+
standard_serifed = 4
|
|
920
|
+
high_trimmed = 5
|
|
921
|
+
high_pointed = 6
|
|
922
|
+
high_serifed = 7
|
|
923
|
+
constant_trimmed = 8
|
|
924
|
+
constant_pointed = 9
|
|
925
|
+
constant_serifed = 10
|
|
926
|
+
low_trimmed = 11
|
|
927
|
+
low_pointed = 12
|
|
928
|
+
low_serifed = 13
|
|
929
|
+
SEQ_FIELDS = ["family_type", "serif_style", "weight", "proportion", "contrast", "stroke_variation", "arm_style", "letter_form", "midline", "x_height"]
|
|
930
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
931
|
+
self._io = _io
|
|
932
|
+
self._parent = _parent
|
|
933
|
+
self._root = _root if _root else self
|
|
934
|
+
self._debug = collections.defaultdict(dict)
|
|
935
|
+
|
|
936
|
+
def _read(self):
|
|
937
|
+
self._debug['family_type']['start'] = self._io.pos()
|
|
938
|
+
self.family_type = KaitaiStream.resolve_enum(Ttf.Os2.Panose.FamilyKind, self._io.read_u1())
|
|
939
|
+
self._debug['family_type']['end'] = self._io.pos()
|
|
940
|
+
self._debug['serif_style']['start'] = self._io.pos()
|
|
941
|
+
self.serif_style = KaitaiStream.resolve_enum(Ttf.Os2.Panose.SerifStyle, self._io.read_u1())
|
|
942
|
+
self._debug['serif_style']['end'] = self._io.pos()
|
|
943
|
+
self._debug['weight']['start'] = self._io.pos()
|
|
944
|
+
self.weight = KaitaiStream.resolve_enum(Ttf.Os2.Panose.Weight, self._io.read_u1())
|
|
945
|
+
self._debug['weight']['end'] = self._io.pos()
|
|
946
|
+
self._debug['proportion']['start'] = self._io.pos()
|
|
947
|
+
self.proportion = KaitaiStream.resolve_enum(Ttf.Os2.Panose.Proportion, self._io.read_u1())
|
|
948
|
+
self._debug['proportion']['end'] = self._io.pos()
|
|
949
|
+
self._debug['contrast']['start'] = self._io.pos()
|
|
950
|
+
self.contrast = KaitaiStream.resolve_enum(Ttf.Os2.Panose.Contrast, self._io.read_u1())
|
|
951
|
+
self._debug['contrast']['end'] = self._io.pos()
|
|
952
|
+
self._debug['stroke_variation']['start'] = self._io.pos()
|
|
953
|
+
self.stroke_variation = KaitaiStream.resolve_enum(Ttf.Os2.Panose.StrokeVariation, self._io.read_u1())
|
|
954
|
+
self._debug['stroke_variation']['end'] = self._io.pos()
|
|
955
|
+
self._debug['arm_style']['start'] = self._io.pos()
|
|
956
|
+
self.arm_style = KaitaiStream.resolve_enum(Ttf.Os2.Panose.ArmStyle, self._io.read_u1())
|
|
957
|
+
self._debug['arm_style']['end'] = self._io.pos()
|
|
958
|
+
self._debug['letter_form']['start'] = self._io.pos()
|
|
959
|
+
self.letter_form = KaitaiStream.resolve_enum(Ttf.Os2.Panose.LetterForm, self._io.read_u1())
|
|
960
|
+
self._debug['letter_form']['end'] = self._io.pos()
|
|
961
|
+
self._debug['midline']['start'] = self._io.pos()
|
|
962
|
+
self.midline = KaitaiStream.resolve_enum(Ttf.Os2.Panose.Midline, self._io.read_u1())
|
|
963
|
+
self._debug['midline']['end'] = self._io.pos()
|
|
964
|
+
self._debug['x_height']['start'] = self._io.pos()
|
|
965
|
+
self.x_height = KaitaiStream.resolve_enum(Ttf.Os2.Panose.XHeight, self._io.read_u1())
|
|
966
|
+
self._debug['x_height']['end'] = self._io.pos()
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
class UnicodeRange(KaitaiStruct):
|
|
970
|
+
SEQ_FIELDS = ["basic_latin", "latin_1_supplement", "latin_extended_a", "latin_extended_b", "ipa_extensions", "spacing_modifier_letters", "combining_diacritical_marks", "basic_greek", "greek_symbols_and_coptic", "cyrillic", "armenian", "basic_hebrew", "hebrew_extended", "basic_arabic", "arabic_extended", "devanagari", "bengali", "gurmukhi", "gujarati", "oriya", "tamil", "telugu", "kannada", "malayalam", "thai", "lao", "basic_georgian", "georgian_extended", "hangul_jamo", "latin_extended_additional", "greek_extended", "general_punctuation", "superscripts_and_subscripts", "currency_symbols", "combining_diacritical_marks_for_symbols", "letterlike_symbols", "number_forms", "arrows", "mathematical_operators", "miscellaneous_technical", "control_pictures", "optical_character_recognition", "enclosed_alphanumerics", "box_drawing", "block_elements", "geometric_shapes", "miscellaneous_symbols", "dingbats", "cjk_symbols_and_punctuation", "hiragana", "katakana", "bopomofo", "hangul_compatibility_jamo", "cjk_miscellaneous", "enclosed_cjk_letters_and_months", "cjk_compatibility", "hangul", "reserved_for_unicode_subranges1", "reserved_for_unicode_subranges2", "cjk_unified_ideographs", "private_use_area", "cjk_compatibility_ideographs", "alphabetic_presentation_forms", "arabic_presentation_forms_a", "combining_half_marks", "cjk_compatibility_forms", "small_form_variants", "arabic_presentation_forms_b", "halfwidth_and_fullwidth_forms", "specials", "reserved"]
|
|
971
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
972
|
+
self._io = _io
|
|
973
|
+
self._parent = _parent
|
|
974
|
+
self._root = _root if _root else self
|
|
975
|
+
self._debug = collections.defaultdict(dict)
|
|
976
|
+
|
|
977
|
+
def _read(self):
|
|
978
|
+
self._debug['basic_latin']['start'] = self._io.pos()
|
|
979
|
+
self.basic_latin = self._io.read_bits_int_be(1) != 0
|
|
980
|
+
self._debug['basic_latin']['end'] = self._io.pos()
|
|
981
|
+
self._debug['latin_1_supplement']['start'] = self._io.pos()
|
|
982
|
+
self.latin_1_supplement = self._io.read_bits_int_be(1) != 0
|
|
983
|
+
self._debug['latin_1_supplement']['end'] = self._io.pos()
|
|
984
|
+
self._debug['latin_extended_a']['start'] = self._io.pos()
|
|
985
|
+
self.latin_extended_a = self._io.read_bits_int_be(1) != 0
|
|
986
|
+
self._debug['latin_extended_a']['end'] = self._io.pos()
|
|
987
|
+
self._debug['latin_extended_b']['start'] = self._io.pos()
|
|
988
|
+
self.latin_extended_b = self._io.read_bits_int_be(1) != 0
|
|
989
|
+
self._debug['latin_extended_b']['end'] = self._io.pos()
|
|
990
|
+
self._debug['ipa_extensions']['start'] = self._io.pos()
|
|
991
|
+
self.ipa_extensions = self._io.read_bits_int_be(1) != 0
|
|
992
|
+
self._debug['ipa_extensions']['end'] = self._io.pos()
|
|
993
|
+
self._debug['spacing_modifier_letters']['start'] = self._io.pos()
|
|
994
|
+
self.spacing_modifier_letters = self._io.read_bits_int_be(1) != 0
|
|
995
|
+
self._debug['spacing_modifier_letters']['end'] = self._io.pos()
|
|
996
|
+
self._debug['combining_diacritical_marks']['start'] = self._io.pos()
|
|
997
|
+
self.combining_diacritical_marks = self._io.read_bits_int_be(1) != 0
|
|
998
|
+
self._debug['combining_diacritical_marks']['end'] = self._io.pos()
|
|
999
|
+
self._debug['basic_greek']['start'] = self._io.pos()
|
|
1000
|
+
self.basic_greek = self._io.read_bits_int_be(1) != 0
|
|
1001
|
+
self._debug['basic_greek']['end'] = self._io.pos()
|
|
1002
|
+
self._debug['greek_symbols_and_coptic']['start'] = self._io.pos()
|
|
1003
|
+
self.greek_symbols_and_coptic = self._io.read_bits_int_be(1) != 0
|
|
1004
|
+
self._debug['greek_symbols_and_coptic']['end'] = self._io.pos()
|
|
1005
|
+
self._debug['cyrillic']['start'] = self._io.pos()
|
|
1006
|
+
self.cyrillic = self._io.read_bits_int_be(1) != 0
|
|
1007
|
+
self._debug['cyrillic']['end'] = self._io.pos()
|
|
1008
|
+
self._debug['armenian']['start'] = self._io.pos()
|
|
1009
|
+
self.armenian = self._io.read_bits_int_be(1) != 0
|
|
1010
|
+
self._debug['armenian']['end'] = self._io.pos()
|
|
1011
|
+
self._debug['basic_hebrew']['start'] = self._io.pos()
|
|
1012
|
+
self.basic_hebrew = self._io.read_bits_int_be(1) != 0
|
|
1013
|
+
self._debug['basic_hebrew']['end'] = self._io.pos()
|
|
1014
|
+
self._debug['hebrew_extended']['start'] = self._io.pos()
|
|
1015
|
+
self.hebrew_extended = self._io.read_bits_int_be(1) != 0
|
|
1016
|
+
self._debug['hebrew_extended']['end'] = self._io.pos()
|
|
1017
|
+
self._debug['basic_arabic']['start'] = self._io.pos()
|
|
1018
|
+
self.basic_arabic = self._io.read_bits_int_be(1) != 0
|
|
1019
|
+
self._debug['basic_arabic']['end'] = self._io.pos()
|
|
1020
|
+
self._debug['arabic_extended']['start'] = self._io.pos()
|
|
1021
|
+
self.arabic_extended = self._io.read_bits_int_be(1) != 0
|
|
1022
|
+
self._debug['arabic_extended']['end'] = self._io.pos()
|
|
1023
|
+
self._debug['devanagari']['start'] = self._io.pos()
|
|
1024
|
+
self.devanagari = self._io.read_bits_int_be(1) != 0
|
|
1025
|
+
self._debug['devanagari']['end'] = self._io.pos()
|
|
1026
|
+
self._debug['bengali']['start'] = self._io.pos()
|
|
1027
|
+
self.bengali = self._io.read_bits_int_be(1) != 0
|
|
1028
|
+
self._debug['bengali']['end'] = self._io.pos()
|
|
1029
|
+
self._debug['gurmukhi']['start'] = self._io.pos()
|
|
1030
|
+
self.gurmukhi = self._io.read_bits_int_be(1) != 0
|
|
1031
|
+
self._debug['gurmukhi']['end'] = self._io.pos()
|
|
1032
|
+
self._debug['gujarati']['start'] = self._io.pos()
|
|
1033
|
+
self.gujarati = self._io.read_bits_int_be(1) != 0
|
|
1034
|
+
self._debug['gujarati']['end'] = self._io.pos()
|
|
1035
|
+
self._debug['oriya']['start'] = self._io.pos()
|
|
1036
|
+
self.oriya = self._io.read_bits_int_be(1) != 0
|
|
1037
|
+
self._debug['oriya']['end'] = self._io.pos()
|
|
1038
|
+
self._debug['tamil']['start'] = self._io.pos()
|
|
1039
|
+
self.tamil = self._io.read_bits_int_be(1) != 0
|
|
1040
|
+
self._debug['tamil']['end'] = self._io.pos()
|
|
1041
|
+
self._debug['telugu']['start'] = self._io.pos()
|
|
1042
|
+
self.telugu = self._io.read_bits_int_be(1) != 0
|
|
1043
|
+
self._debug['telugu']['end'] = self._io.pos()
|
|
1044
|
+
self._debug['kannada']['start'] = self._io.pos()
|
|
1045
|
+
self.kannada = self._io.read_bits_int_be(1) != 0
|
|
1046
|
+
self._debug['kannada']['end'] = self._io.pos()
|
|
1047
|
+
self._debug['malayalam']['start'] = self._io.pos()
|
|
1048
|
+
self.malayalam = self._io.read_bits_int_be(1) != 0
|
|
1049
|
+
self._debug['malayalam']['end'] = self._io.pos()
|
|
1050
|
+
self._debug['thai']['start'] = self._io.pos()
|
|
1051
|
+
self.thai = self._io.read_bits_int_be(1) != 0
|
|
1052
|
+
self._debug['thai']['end'] = self._io.pos()
|
|
1053
|
+
self._debug['lao']['start'] = self._io.pos()
|
|
1054
|
+
self.lao = self._io.read_bits_int_be(1) != 0
|
|
1055
|
+
self._debug['lao']['end'] = self._io.pos()
|
|
1056
|
+
self._debug['basic_georgian']['start'] = self._io.pos()
|
|
1057
|
+
self.basic_georgian = self._io.read_bits_int_be(1) != 0
|
|
1058
|
+
self._debug['basic_georgian']['end'] = self._io.pos()
|
|
1059
|
+
self._debug['georgian_extended']['start'] = self._io.pos()
|
|
1060
|
+
self.georgian_extended = self._io.read_bits_int_be(1) != 0
|
|
1061
|
+
self._debug['georgian_extended']['end'] = self._io.pos()
|
|
1062
|
+
self._debug['hangul_jamo']['start'] = self._io.pos()
|
|
1063
|
+
self.hangul_jamo = self._io.read_bits_int_be(1) != 0
|
|
1064
|
+
self._debug['hangul_jamo']['end'] = self._io.pos()
|
|
1065
|
+
self._debug['latin_extended_additional']['start'] = self._io.pos()
|
|
1066
|
+
self.latin_extended_additional = self._io.read_bits_int_be(1) != 0
|
|
1067
|
+
self._debug['latin_extended_additional']['end'] = self._io.pos()
|
|
1068
|
+
self._debug['greek_extended']['start'] = self._io.pos()
|
|
1069
|
+
self.greek_extended = self._io.read_bits_int_be(1) != 0
|
|
1070
|
+
self._debug['greek_extended']['end'] = self._io.pos()
|
|
1071
|
+
self._debug['general_punctuation']['start'] = self._io.pos()
|
|
1072
|
+
self.general_punctuation = self._io.read_bits_int_be(1) != 0
|
|
1073
|
+
self._debug['general_punctuation']['end'] = self._io.pos()
|
|
1074
|
+
self._debug['superscripts_and_subscripts']['start'] = self._io.pos()
|
|
1075
|
+
self.superscripts_and_subscripts = self._io.read_bits_int_be(1) != 0
|
|
1076
|
+
self._debug['superscripts_and_subscripts']['end'] = self._io.pos()
|
|
1077
|
+
self._debug['currency_symbols']['start'] = self._io.pos()
|
|
1078
|
+
self.currency_symbols = self._io.read_bits_int_be(1) != 0
|
|
1079
|
+
self._debug['currency_symbols']['end'] = self._io.pos()
|
|
1080
|
+
self._debug['combining_diacritical_marks_for_symbols']['start'] = self._io.pos()
|
|
1081
|
+
self.combining_diacritical_marks_for_symbols = self._io.read_bits_int_be(1) != 0
|
|
1082
|
+
self._debug['combining_diacritical_marks_for_symbols']['end'] = self._io.pos()
|
|
1083
|
+
self._debug['letterlike_symbols']['start'] = self._io.pos()
|
|
1084
|
+
self.letterlike_symbols = self._io.read_bits_int_be(1) != 0
|
|
1085
|
+
self._debug['letterlike_symbols']['end'] = self._io.pos()
|
|
1086
|
+
self._debug['number_forms']['start'] = self._io.pos()
|
|
1087
|
+
self.number_forms = self._io.read_bits_int_be(1) != 0
|
|
1088
|
+
self._debug['number_forms']['end'] = self._io.pos()
|
|
1089
|
+
self._debug['arrows']['start'] = self._io.pos()
|
|
1090
|
+
self.arrows = self._io.read_bits_int_be(1) != 0
|
|
1091
|
+
self._debug['arrows']['end'] = self._io.pos()
|
|
1092
|
+
self._debug['mathematical_operators']['start'] = self._io.pos()
|
|
1093
|
+
self.mathematical_operators = self._io.read_bits_int_be(1) != 0
|
|
1094
|
+
self._debug['mathematical_operators']['end'] = self._io.pos()
|
|
1095
|
+
self._debug['miscellaneous_technical']['start'] = self._io.pos()
|
|
1096
|
+
self.miscellaneous_technical = self._io.read_bits_int_be(1) != 0
|
|
1097
|
+
self._debug['miscellaneous_technical']['end'] = self._io.pos()
|
|
1098
|
+
self._debug['control_pictures']['start'] = self._io.pos()
|
|
1099
|
+
self.control_pictures = self._io.read_bits_int_be(1) != 0
|
|
1100
|
+
self._debug['control_pictures']['end'] = self._io.pos()
|
|
1101
|
+
self._debug['optical_character_recognition']['start'] = self._io.pos()
|
|
1102
|
+
self.optical_character_recognition = self._io.read_bits_int_be(1) != 0
|
|
1103
|
+
self._debug['optical_character_recognition']['end'] = self._io.pos()
|
|
1104
|
+
self._debug['enclosed_alphanumerics']['start'] = self._io.pos()
|
|
1105
|
+
self.enclosed_alphanumerics = self._io.read_bits_int_be(1) != 0
|
|
1106
|
+
self._debug['enclosed_alphanumerics']['end'] = self._io.pos()
|
|
1107
|
+
self._debug['box_drawing']['start'] = self._io.pos()
|
|
1108
|
+
self.box_drawing = self._io.read_bits_int_be(1) != 0
|
|
1109
|
+
self._debug['box_drawing']['end'] = self._io.pos()
|
|
1110
|
+
self._debug['block_elements']['start'] = self._io.pos()
|
|
1111
|
+
self.block_elements = self._io.read_bits_int_be(1) != 0
|
|
1112
|
+
self._debug['block_elements']['end'] = self._io.pos()
|
|
1113
|
+
self._debug['geometric_shapes']['start'] = self._io.pos()
|
|
1114
|
+
self.geometric_shapes = self._io.read_bits_int_be(1) != 0
|
|
1115
|
+
self._debug['geometric_shapes']['end'] = self._io.pos()
|
|
1116
|
+
self._debug['miscellaneous_symbols']['start'] = self._io.pos()
|
|
1117
|
+
self.miscellaneous_symbols = self._io.read_bits_int_be(1) != 0
|
|
1118
|
+
self._debug['miscellaneous_symbols']['end'] = self._io.pos()
|
|
1119
|
+
self._debug['dingbats']['start'] = self._io.pos()
|
|
1120
|
+
self.dingbats = self._io.read_bits_int_be(1) != 0
|
|
1121
|
+
self._debug['dingbats']['end'] = self._io.pos()
|
|
1122
|
+
self._debug['cjk_symbols_and_punctuation']['start'] = self._io.pos()
|
|
1123
|
+
self.cjk_symbols_and_punctuation = self._io.read_bits_int_be(1) != 0
|
|
1124
|
+
self._debug['cjk_symbols_and_punctuation']['end'] = self._io.pos()
|
|
1125
|
+
self._debug['hiragana']['start'] = self._io.pos()
|
|
1126
|
+
self.hiragana = self._io.read_bits_int_be(1) != 0
|
|
1127
|
+
self._debug['hiragana']['end'] = self._io.pos()
|
|
1128
|
+
self._debug['katakana']['start'] = self._io.pos()
|
|
1129
|
+
self.katakana = self._io.read_bits_int_be(1) != 0
|
|
1130
|
+
self._debug['katakana']['end'] = self._io.pos()
|
|
1131
|
+
self._debug['bopomofo']['start'] = self._io.pos()
|
|
1132
|
+
self.bopomofo = self._io.read_bits_int_be(1) != 0
|
|
1133
|
+
self._debug['bopomofo']['end'] = self._io.pos()
|
|
1134
|
+
self._debug['hangul_compatibility_jamo']['start'] = self._io.pos()
|
|
1135
|
+
self.hangul_compatibility_jamo = self._io.read_bits_int_be(1) != 0
|
|
1136
|
+
self._debug['hangul_compatibility_jamo']['end'] = self._io.pos()
|
|
1137
|
+
self._debug['cjk_miscellaneous']['start'] = self._io.pos()
|
|
1138
|
+
self.cjk_miscellaneous = self._io.read_bits_int_be(1) != 0
|
|
1139
|
+
self._debug['cjk_miscellaneous']['end'] = self._io.pos()
|
|
1140
|
+
self._debug['enclosed_cjk_letters_and_months']['start'] = self._io.pos()
|
|
1141
|
+
self.enclosed_cjk_letters_and_months = self._io.read_bits_int_be(1) != 0
|
|
1142
|
+
self._debug['enclosed_cjk_letters_and_months']['end'] = self._io.pos()
|
|
1143
|
+
self._debug['cjk_compatibility']['start'] = self._io.pos()
|
|
1144
|
+
self.cjk_compatibility = self._io.read_bits_int_be(1) != 0
|
|
1145
|
+
self._debug['cjk_compatibility']['end'] = self._io.pos()
|
|
1146
|
+
self._debug['hangul']['start'] = self._io.pos()
|
|
1147
|
+
self.hangul = self._io.read_bits_int_be(1) != 0
|
|
1148
|
+
self._debug['hangul']['end'] = self._io.pos()
|
|
1149
|
+
self._debug['reserved_for_unicode_subranges1']['start'] = self._io.pos()
|
|
1150
|
+
self.reserved_for_unicode_subranges1 = self._io.read_bits_int_be(1) != 0
|
|
1151
|
+
self._debug['reserved_for_unicode_subranges1']['end'] = self._io.pos()
|
|
1152
|
+
self._debug['reserved_for_unicode_subranges2']['start'] = self._io.pos()
|
|
1153
|
+
self.reserved_for_unicode_subranges2 = self._io.read_bits_int_be(1) != 0
|
|
1154
|
+
self._debug['reserved_for_unicode_subranges2']['end'] = self._io.pos()
|
|
1155
|
+
self._debug['cjk_unified_ideographs']['start'] = self._io.pos()
|
|
1156
|
+
self.cjk_unified_ideographs = self._io.read_bits_int_be(1) != 0
|
|
1157
|
+
self._debug['cjk_unified_ideographs']['end'] = self._io.pos()
|
|
1158
|
+
self._debug['private_use_area']['start'] = self._io.pos()
|
|
1159
|
+
self.private_use_area = self._io.read_bits_int_be(1) != 0
|
|
1160
|
+
self._debug['private_use_area']['end'] = self._io.pos()
|
|
1161
|
+
self._debug['cjk_compatibility_ideographs']['start'] = self._io.pos()
|
|
1162
|
+
self.cjk_compatibility_ideographs = self._io.read_bits_int_be(1) != 0
|
|
1163
|
+
self._debug['cjk_compatibility_ideographs']['end'] = self._io.pos()
|
|
1164
|
+
self._debug['alphabetic_presentation_forms']['start'] = self._io.pos()
|
|
1165
|
+
self.alphabetic_presentation_forms = self._io.read_bits_int_be(1) != 0
|
|
1166
|
+
self._debug['alphabetic_presentation_forms']['end'] = self._io.pos()
|
|
1167
|
+
self._debug['arabic_presentation_forms_a']['start'] = self._io.pos()
|
|
1168
|
+
self.arabic_presentation_forms_a = self._io.read_bits_int_be(1) != 0
|
|
1169
|
+
self._debug['arabic_presentation_forms_a']['end'] = self._io.pos()
|
|
1170
|
+
self._debug['combining_half_marks']['start'] = self._io.pos()
|
|
1171
|
+
self.combining_half_marks = self._io.read_bits_int_be(1) != 0
|
|
1172
|
+
self._debug['combining_half_marks']['end'] = self._io.pos()
|
|
1173
|
+
self._debug['cjk_compatibility_forms']['start'] = self._io.pos()
|
|
1174
|
+
self.cjk_compatibility_forms = self._io.read_bits_int_be(1) != 0
|
|
1175
|
+
self._debug['cjk_compatibility_forms']['end'] = self._io.pos()
|
|
1176
|
+
self._debug['small_form_variants']['start'] = self._io.pos()
|
|
1177
|
+
self.small_form_variants = self._io.read_bits_int_be(1) != 0
|
|
1178
|
+
self._debug['small_form_variants']['end'] = self._io.pos()
|
|
1179
|
+
self._debug['arabic_presentation_forms_b']['start'] = self._io.pos()
|
|
1180
|
+
self.arabic_presentation_forms_b = self._io.read_bits_int_be(1) != 0
|
|
1181
|
+
self._debug['arabic_presentation_forms_b']['end'] = self._io.pos()
|
|
1182
|
+
self._debug['halfwidth_and_fullwidth_forms']['start'] = self._io.pos()
|
|
1183
|
+
self.halfwidth_and_fullwidth_forms = self._io.read_bits_int_be(1) != 0
|
|
1184
|
+
self._debug['halfwidth_and_fullwidth_forms']['end'] = self._io.pos()
|
|
1185
|
+
self._debug['specials']['start'] = self._io.pos()
|
|
1186
|
+
self.specials = self._io.read_bits_int_be(1) != 0
|
|
1187
|
+
self._debug['specials']['end'] = self._io.pos()
|
|
1188
|
+
self._io.align_to_byte()
|
|
1189
|
+
self._debug['reserved']['start'] = self._io.pos()
|
|
1190
|
+
self.reserved = self._io.read_bytes(7)
|
|
1191
|
+
self._debug['reserved']['end'] = self._io.pos()
|
|
1192
|
+
|
|
1193
|
+
|
|
1194
|
+
class CodePageRange(KaitaiStruct):
|
|
1195
|
+
SEQ_FIELDS = ["symbol_character_set", "oem_character_set", "macintosh_character_set", "reserved_for_alternate_ansi_oem", "cp1361_korean_johab", "cp950_chinese_traditional_chars_taiwan_and_hong_kong", "cp949_korean_wansung", "cp936_chinese_simplified_chars_prc_and_singapore", "cp932_jis_japan", "cp874_thai", "reserved_for_alternate_ansi", "cp1257_windows_baltic", "cp1256_arabic", "cp1255_hebrew", "cp1254_turkish", "cp1253_greek", "cp1251_cyrillic", "cp1250_latin_2_eastern_europe", "cp1252_latin_1", "cp437_us", "cp850_we_latin_1", "cp708_arabic_asmo_708", "cp737_greek_former_437_g", "cp775_ms_dos_baltic", "cp852_latin_2", "cp855_ibm_cyrillic_primarily_russian", "cp857_ibm_turkish", "cp860_ms_dos_portuguese", "cp861_ms_dos_icelandic", "cp862_hebrew", "cp863_ms_dos_canadian_french", "cp864_arabic", "cp865_ms_dos_nordic", "cp866_ms_dos_russian", "cp869_ibm_greek", "reserved_for_oem"]
|
|
1196
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
1197
|
+
self._io = _io
|
|
1198
|
+
self._parent = _parent
|
|
1199
|
+
self._root = _root if _root else self
|
|
1200
|
+
self._debug = collections.defaultdict(dict)
|
|
1201
|
+
|
|
1202
|
+
def _read(self):
|
|
1203
|
+
self._debug['symbol_character_set']['start'] = self._io.pos()
|
|
1204
|
+
self.symbol_character_set = self._io.read_bits_int_be(1) != 0
|
|
1205
|
+
self._debug['symbol_character_set']['end'] = self._io.pos()
|
|
1206
|
+
self._debug['oem_character_set']['start'] = self._io.pos()
|
|
1207
|
+
self.oem_character_set = self._io.read_bits_int_be(1) != 0
|
|
1208
|
+
self._debug['oem_character_set']['end'] = self._io.pos()
|
|
1209
|
+
self._debug['macintosh_character_set']['start'] = self._io.pos()
|
|
1210
|
+
self.macintosh_character_set = self._io.read_bits_int_be(1) != 0
|
|
1211
|
+
self._debug['macintosh_character_set']['end'] = self._io.pos()
|
|
1212
|
+
self._debug['reserved_for_alternate_ansi_oem']['start'] = self._io.pos()
|
|
1213
|
+
self.reserved_for_alternate_ansi_oem = self._io.read_bits_int_be(7)
|
|
1214
|
+
self._debug['reserved_for_alternate_ansi_oem']['end'] = self._io.pos()
|
|
1215
|
+
self._debug['cp1361_korean_johab']['start'] = self._io.pos()
|
|
1216
|
+
self.cp1361_korean_johab = self._io.read_bits_int_be(1) != 0
|
|
1217
|
+
self._debug['cp1361_korean_johab']['end'] = self._io.pos()
|
|
1218
|
+
self._debug['cp950_chinese_traditional_chars_taiwan_and_hong_kong']['start'] = self._io.pos()
|
|
1219
|
+
self.cp950_chinese_traditional_chars_taiwan_and_hong_kong = self._io.read_bits_int_be(1) != 0
|
|
1220
|
+
self._debug['cp950_chinese_traditional_chars_taiwan_and_hong_kong']['end'] = self._io.pos()
|
|
1221
|
+
self._debug['cp949_korean_wansung']['start'] = self._io.pos()
|
|
1222
|
+
self.cp949_korean_wansung = self._io.read_bits_int_be(1) != 0
|
|
1223
|
+
self._debug['cp949_korean_wansung']['end'] = self._io.pos()
|
|
1224
|
+
self._debug['cp936_chinese_simplified_chars_prc_and_singapore']['start'] = self._io.pos()
|
|
1225
|
+
self.cp936_chinese_simplified_chars_prc_and_singapore = self._io.read_bits_int_be(1) != 0
|
|
1226
|
+
self._debug['cp936_chinese_simplified_chars_prc_and_singapore']['end'] = self._io.pos()
|
|
1227
|
+
self._debug['cp932_jis_japan']['start'] = self._io.pos()
|
|
1228
|
+
self.cp932_jis_japan = self._io.read_bits_int_be(1) != 0
|
|
1229
|
+
self._debug['cp932_jis_japan']['end'] = self._io.pos()
|
|
1230
|
+
self._debug['cp874_thai']['start'] = self._io.pos()
|
|
1231
|
+
self.cp874_thai = self._io.read_bits_int_be(1) != 0
|
|
1232
|
+
self._debug['cp874_thai']['end'] = self._io.pos()
|
|
1233
|
+
self._debug['reserved_for_alternate_ansi']['start'] = self._io.pos()
|
|
1234
|
+
self.reserved_for_alternate_ansi = self._io.read_bits_int_be(8)
|
|
1235
|
+
self._debug['reserved_for_alternate_ansi']['end'] = self._io.pos()
|
|
1236
|
+
self._debug['cp1257_windows_baltic']['start'] = self._io.pos()
|
|
1237
|
+
self.cp1257_windows_baltic = self._io.read_bits_int_be(1) != 0
|
|
1238
|
+
self._debug['cp1257_windows_baltic']['end'] = self._io.pos()
|
|
1239
|
+
self._debug['cp1256_arabic']['start'] = self._io.pos()
|
|
1240
|
+
self.cp1256_arabic = self._io.read_bits_int_be(1) != 0
|
|
1241
|
+
self._debug['cp1256_arabic']['end'] = self._io.pos()
|
|
1242
|
+
self._debug['cp1255_hebrew']['start'] = self._io.pos()
|
|
1243
|
+
self.cp1255_hebrew = self._io.read_bits_int_be(1) != 0
|
|
1244
|
+
self._debug['cp1255_hebrew']['end'] = self._io.pos()
|
|
1245
|
+
self._debug['cp1254_turkish']['start'] = self._io.pos()
|
|
1246
|
+
self.cp1254_turkish = self._io.read_bits_int_be(1) != 0
|
|
1247
|
+
self._debug['cp1254_turkish']['end'] = self._io.pos()
|
|
1248
|
+
self._debug['cp1253_greek']['start'] = self._io.pos()
|
|
1249
|
+
self.cp1253_greek = self._io.read_bits_int_be(1) != 0
|
|
1250
|
+
self._debug['cp1253_greek']['end'] = self._io.pos()
|
|
1251
|
+
self._debug['cp1251_cyrillic']['start'] = self._io.pos()
|
|
1252
|
+
self.cp1251_cyrillic = self._io.read_bits_int_be(1) != 0
|
|
1253
|
+
self._debug['cp1251_cyrillic']['end'] = self._io.pos()
|
|
1254
|
+
self._debug['cp1250_latin_2_eastern_europe']['start'] = self._io.pos()
|
|
1255
|
+
self.cp1250_latin_2_eastern_europe = self._io.read_bits_int_be(1) != 0
|
|
1256
|
+
self._debug['cp1250_latin_2_eastern_europe']['end'] = self._io.pos()
|
|
1257
|
+
self._debug['cp1252_latin_1']['start'] = self._io.pos()
|
|
1258
|
+
self.cp1252_latin_1 = self._io.read_bits_int_be(1) != 0
|
|
1259
|
+
self._debug['cp1252_latin_1']['end'] = self._io.pos()
|
|
1260
|
+
self._debug['cp437_us']['start'] = self._io.pos()
|
|
1261
|
+
self.cp437_us = self._io.read_bits_int_be(1) != 0
|
|
1262
|
+
self._debug['cp437_us']['end'] = self._io.pos()
|
|
1263
|
+
self._debug['cp850_we_latin_1']['start'] = self._io.pos()
|
|
1264
|
+
self.cp850_we_latin_1 = self._io.read_bits_int_be(1) != 0
|
|
1265
|
+
self._debug['cp850_we_latin_1']['end'] = self._io.pos()
|
|
1266
|
+
self._debug['cp708_arabic_asmo_708']['start'] = self._io.pos()
|
|
1267
|
+
self.cp708_arabic_asmo_708 = self._io.read_bits_int_be(1) != 0
|
|
1268
|
+
self._debug['cp708_arabic_asmo_708']['end'] = self._io.pos()
|
|
1269
|
+
self._debug['cp737_greek_former_437_g']['start'] = self._io.pos()
|
|
1270
|
+
self.cp737_greek_former_437_g = self._io.read_bits_int_be(1) != 0
|
|
1271
|
+
self._debug['cp737_greek_former_437_g']['end'] = self._io.pos()
|
|
1272
|
+
self._debug['cp775_ms_dos_baltic']['start'] = self._io.pos()
|
|
1273
|
+
self.cp775_ms_dos_baltic = self._io.read_bits_int_be(1) != 0
|
|
1274
|
+
self._debug['cp775_ms_dos_baltic']['end'] = self._io.pos()
|
|
1275
|
+
self._debug['cp852_latin_2']['start'] = self._io.pos()
|
|
1276
|
+
self.cp852_latin_2 = self._io.read_bits_int_be(1) != 0
|
|
1277
|
+
self._debug['cp852_latin_2']['end'] = self._io.pos()
|
|
1278
|
+
self._debug['cp855_ibm_cyrillic_primarily_russian']['start'] = self._io.pos()
|
|
1279
|
+
self.cp855_ibm_cyrillic_primarily_russian = self._io.read_bits_int_be(1) != 0
|
|
1280
|
+
self._debug['cp855_ibm_cyrillic_primarily_russian']['end'] = self._io.pos()
|
|
1281
|
+
self._debug['cp857_ibm_turkish']['start'] = self._io.pos()
|
|
1282
|
+
self.cp857_ibm_turkish = self._io.read_bits_int_be(1) != 0
|
|
1283
|
+
self._debug['cp857_ibm_turkish']['end'] = self._io.pos()
|
|
1284
|
+
self._debug['cp860_ms_dos_portuguese']['start'] = self._io.pos()
|
|
1285
|
+
self.cp860_ms_dos_portuguese = self._io.read_bits_int_be(1) != 0
|
|
1286
|
+
self._debug['cp860_ms_dos_portuguese']['end'] = self._io.pos()
|
|
1287
|
+
self._debug['cp861_ms_dos_icelandic']['start'] = self._io.pos()
|
|
1288
|
+
self.cp861_ms_dos_icelandic = self._io.read_bits_int_be(1) != 0
|
|
1289
|
+
self._debug['cp861_ms_dos_icelandic']['end'] = self._io.pos()
|
|
1290
|
+
self._debug['cp862_hebrew']['start'] = self._io.pos()
|
|
1291
|
+
self.cp862_hebrew = self._io.read_bits_int_be(1) != 0
|
|
1292
|
+
self._debug['cp862_hebrew']['end'] = self._io.pos()
|
|
1293
|
+
self._debug['cp863_ms_dos_canadian_french']['start'] = self._io.pos()
|
|
1294
|
+
self.cp863_ms_dos_canadian_french = self._io.read_bits_int_be(1) != 0
|
|
1295
|
+
self._debug['cp863_ms_dos_canadian_french']['end'] = self._io.pos()
|
|
1296
|
+
self._debug['cp864_arabic']['start'] = self._io.pos()
|
|
1297
|
+
self.cp864_arabic = self._io.read_bits_int_be(1) != 0
|
|
1298
|
+
self._debug['cp864_arabic']['end'] = self._io.pos()
|
|
1299
|
+
self._debug['cp865_ms_dos_nordic']['start'] = self._io.pos()
|
|
1300
|
+
self.cp865_ms_dos_nordic = self._io.read_bits_int_be(1) != 0
|
|
1301
|
+
self._debug['cp865_ms_dos_nordic']['end'] = self._io.pos()
|
|
1302
|
+
self._debug['cp866_ms_dos_russian']['start'] = self._io.pos()
|
|
1303
|
+
self.cp866_ms_dos_russian = self._io.read_bits_int_be(1) != 0
|
|
1304
|
+
self._debug['cp866_ms_dos_russian']['end'] = self._io.pos()
|
|
1305
|
+
self._debug['cp869_ibm_greek']['start'] = self._io.pos()
|
|
1306
|
+
self.cp869_ibm_greek = self._io.read_bits_int_be(1) != 0
|
|
1307
|
+
self._debug['cp869_ibm_greek']['end'] = self._io.pos()
|
|
1308
|
+
self._debug['reserved_for_oem']['start'] = self._io.pos()
|
|
1309
|
+
self.reserved_for_oem = self._io.read_bits_int_be(16)
|
|
1310
|
+
self._debug['reserved_for_oem']['end'] = self._io.pos()
|
|
1311
|
+
|
|
1312
|
+
|
|
1313
|
+
|
|
1314
|
+
class Fixed(KaitaiStruct):
|
|
1315
|
+
SEQ_FIELDS = ["major", "minor"]
|
|
1316
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
1317
|
+
self._io = _io
|
|
1318
|
+
self._parent = _parent
|
|
1319
|
+
self._root = _root if _root else self
|
|
1320
|
+
self._debug = collections.defaultdict(dict)
|
|
1321
|
+
|
|
1322
|
+
def _read(self):
|
|
1323
|
+
self._debug['major']['start'] = self._io.pos()
|
|
1324
|
+
self.major = self._io.read_u2be()
|
|
1325
|
+
self._debug['major']['end'] = self._io.pos()
|
|
1326
|
+
self._debug['minor']['start'] = self._io.pos()
|
|
1327
|
+
self.minor = self._io.read_u2be()
|
|
1328
|
+
self._debug['minor']['end'] = self._io.pos()
|
|
1329
|
+
|
|
1330
|
+
|
|
1331
|
+
class Glyf(KaitaiStruct):
|
|
1332
|
+
SEQ_FIELDS = ["number_of_contours", "x_min", "y_min", "x_max", "y_max", "value"]
|
|
1333
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
1334
|
+
self._io = _io
|
|
1335
|
+
self._parent = _parent
|
|
1336
|
+
self._root = _root if _root else self
|
|
1337
|
+
self._debug = collections.defaultdict(dict)
|
|
1338
|
+
|
|
1339
|
+
def _read(self):
|
|
1340
|
+
self._debug['number_of_contours']['start'] = self._io.pos()
|
|
1341
|
+
self.number_of_contours = self._io.read_s2be()
|
|
1342
|
+
self._debug['number_of_contours']['end'] = self._io.pos()
|
|
1343
|
+
self._debug['x_min']['start'] = self._io.pos()
|
|
1344
|
+
self.x_min = self._io.read_s2be()
|
|
1345
|
+
self._debug['x_min']['end'] = self._io.pos()
|
|
1346
|
+
self._debug['y_min']['start'] = self._io.pos()
|
|
1347
|
+
self.y_min = self._io.read_s2be()
|
|
1348
|
+
self._debug['y_min']['end'] = self._io.pos()
|
|
1349
|
+
self._debug['x_max']['start'] = self._io.pos()
|
|
1350
|
+
self.x_max = self._io.read_s2be()
|
|
1351
|
+
self._debug['x_max']['end'] = self._io.pos()
|
|
1352
|
+
self._debug['y_max']['start'] = self._io.pos()
|
|
1353
|
+
self.y_max = self._io.read_s2be()
|
|
1354
|
+
self._debug['y_max']['end'] = self._io.pos()
|
|
1355
|
+
if self.number_of_contours > 0:
|
|
1356
|
+
self._debug['value']['start'] = self._io.pos()
|
|
1357
|
+
self.value = Ttf.Glyf.SimpleGlyph(self._io, self, self._root)
|
|
1358
|
+
self.value._read()
|
|
1359
|
+
self._debug['value']['end'] = self._io.pos()
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
class SimpleGlyph(KaitaiStruct):
|
|
1363
|
+
SEQ_FIELDS = ["end_pts_of_contours", "instruction_length", "instructions", "flags"]
|
|
1364
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
1365
|
+
self._io = _io
|
|
1366
|
+
self._parent = _parent
|
|
1367
|
+
self._root = _root if _root else self
|
|
1368
|
+
self._debug = collections.defaultdict(dict)
|
|
1369
|
+
|
|
1370
|
+
def _read(self):
|
|
1371
|
+
self._debug['end_pts_of_contours']['start'] = self._io.pos()
|
|
1372
|
+
self.end_pts_of_contours = [None] * (self._parent.number_of_contours)
|
|
1373
|
+
for i in range(self._parent.number_of_contours):
|
|
1374
|
+
if not 'arr' in self._debug['end_pts_of_contours']:
|
|
1375
|
+
self._debug['end_pts_of_contours']['arr'] = []
|
|
1376
|
+
self._debug['end_pts_of_contours']['arr'].append({'start': self._io.pos()})
|
|
1377
|
+
self.end_pts_of_contours[i] = self._io.read_u2be()
|
|
1378
|
+
self._debug['end_pts_of_contours']['arr'][i]['end'] = self._io.pos()
|
|
1379
|
+
|
|
1380
|
+
self._debug['end_pts_of_contours']['end'] = self._io.pos()
|
|
1381
|
+
self._debug['instruction_length']['start'] = self._io.pos()
|
|
1382
|
+
self.instruction_length = self._io.read_u2be()
|
|
1383
|
+
self._debug['instruction_length']['end'] = self._io.pos()
|
|
1384
|
+
self._debug['instructions']['start'] = self._io.pos()
|
|
1385
|
+
self.instructions = self._io.read_bytes(self.instruction_length)
|
|
1386
|
+
self._debug['instructions']['end'] = self._io.pos()
|
|
1387
|
+
self._debug['flags']['start'] = self._io.pos()
|
|
1388
|
+
self.flags = [None] * (self.point_count)
|
|
1389
|
+
for i in range(self.point_count):
|
|
1390
|
+
if not 'arr' in self._debug['flags']:
|
|
1391
|
+
self._debug['flags']['arr'] = []
|
|
1392
|
+
self._debug['flags']['arr'].append({'start': self._io.pos()})
|
|
1393
|
+
_t_flags = Ttf.Glyf.SimpleGlyph.Flag(self._io, self, self._root)
|
|
1394
|
+
_t_flags._read()
|
|
1395
|
+
self.flags[i] = _t_flags
|
|
1396
|
+
self._debug['flags']['arr'][i]['end'] = self._io.pos()
|
|
1397
|
+
|
|
1398
|
+
self._debug['flags']['end'] = self._io.pos()
|
|
1399
|
+
|
|
1400
|
+
class Flag(KaitaiStruct):
|
|
1401
|
+
SEQ_FIELDS = ["reserved", "y_is_same", "x_is_same", "repeat", "y_short_vector", "x_short_vector", "on_curve", "repeat_value"]
|
|
1402
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
1403
|
+
self._io = _io
|
|
1404
|
+
self._parent = _parent
|
|
1405
|
+
self._root = _root if _root else self
|
|
1406
|
+
self._debug = collections.defaultdict(dict)
|
|
1407
|
+
|
|
1408
|
+
def _read(self):
|
|
1409
|
+
self._debug['reserved']['start'] = self._io.pos()
|
|
1410
|
+
self.reserved = self._io.read_bits_int_be(2)
|
|
1411
|
+
self._debug['reserved']['end'] = self._io.pos()
|
|
1412
|
+
self._debug['y_is_same']['start'] = self._io.pos()
|
|
1413
|
+
self.y_is_same = self._io.read_bits_int_be(1) != 0
|
|
1414
|
+
self._debug['y_is_same']['end'] = self._io.pos()
|
|
1415
|
+
self._debug['x_is_same']['start'] = self._io.pos()
|
|
1416
|
+
self.x_is_same = self._io.read_bits_int_be(1) != 0
|
|
1417
|
+
self._debug['x_is_same']['end'] = self._io.pos()
|
|
1418
|
+
self._debug['repeat']['start'] = self._io.pos()
|
|
1419
|
+
self.repeat = self._io.read_bits_int_be(1) != 0
|
|
1420
|
+
self._debug['repeat']['end'] = self._io.pos()
|
|
1421
|
+
self._debug['y_short_vector']['start'] = self._io.pos()
|
|
1422
|
+
self.y_short_vector = self._io.read_bits_int_be(1) != 0
|
|
1423
|
+
self._debug['y_short_vector']['end'] = self._io.pos()
|
|
1424
|
+
self._debug['x_short_vector']['start'] = self._io.pos()
|
|
1425
|
+
self.x_short_vector = self._io.read_bits_int_be(1) != 0
|
|
1426
|
+
self._debug['x_short_vector']['end'] = self._io.pos()
|
|
1427
|
+
self._debug['on_curve']['start'] = self._io.pos()
|
|
1428
|
+
self.on_curve = self._io.read_bits_int_be(1) != 0
|
|
1429
|
+
self._debug['on_curve']['end'] = self._io.pos()
|
|
1430
|
+
self._io.align_to_byte()
|
|
1431
|
+
if self.repeat:
|
|
1432
|
+
self._debug['repeat_value']['start'] = self._io.pos()
|
|
1433
|
+
self.repeat_value = self._io.read_u1()
|
|
1434
|
+
self._debug['repeat_value']['end'] = self._io.pos()
|
|
1435
|
+
|
|
1436
|
+
|
|
1437
|
+
|
|
1438
|
+
@property
|
|
1439
|
+
def point_count(self):
|
|
1440
|
+
if hasattr(self, '_m_point_count'):
|
|
1441
|
+
return self._m_point_count if hasattr(self, '_m_point_count') else None
|
|
1442
|
+
|
|
1443
|
+
self._m_point_count = (max(self.end_pts_of_contours) + 1)
|
|
1444
|
+
return self._m_point_count if hasattr(self, '_m_point_count') else None
|
|
1445
|
+
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
class Cvt(KaitaiStruct):
|
|
1449
|
+
"""cvt - Control Value Table This table contains a list of values that can be referenced by instructions. They can be used, among other things, to control characteristics for different glyphs.
|
|
1450
|
+
"""
|
|
1451
|
+
SEQ_FIELDS = ["fwords"]
|
|
1452
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
1453
|
+
self._io = _io
|
|
1454
|
+
self._parent = _parent
|
|
1455
|
+
self._root = _root if _root else self
|
|
1456
|
+
self._debug = collections.defaultdict(dict)
|
|
1457
|
+
|
|
1458
|
+
def _read(self):
|
|
1459
|
+
self._debug['fwords']['start'] = self._io.pos()
|
|
1460
|
+
self.fwords = []
|
|
1461
|
+
i = 0
|
|
1462
|
+
while not self._io.is_eof():
|
|
1463
|
+
if not 'arr' in self._debug['fwords']:
|
|
1464
|
+
self._debug['fwords']['arr'] = []
|
|
1465
|
+
self._debug['fwords']['arr'].append({'start': self._io.pos()})
|
|
1466
|
+
self.fwords.append(self._io.read_s2be())
|
|
1467
|
+
self._debug['fwords']['arr'][len(self.fwords) - 1]['end'] = self._io.pos()
|
|
1468
|
+
i += 1
|
|
1469
|
+
|
|
1470
|
+
self._debug['fwords']['end'] = self._io.pos()
|
|
1471
|
+
|
|
1472
|
+
|
|
1473
|
+
class Maxp(KaitaiStruct):
|
|
1474
|
+
SEQ_FIELDS = ["table_version_number", "num_glyphs", "version10_body"]
|
|
1475
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
1476
|
+
self._io = _io
|
|
1477
|
+
self._parent = _parent
|
|
1478
|
+
self._root = _root if _root else self
|
|
1479
|
+
self._debug = collections.defaultdict(dict)
|
|
1480
|
+
|
|
1481
|
+
def _read(self):
|
|
1482
|
+
self._debug['table_version_number']['start'] = self._io.pos()
|
|
1483
|
+
self.table_version_number = Ttf.Fixed(self._io, self, self._root)
|
|
1484
|
+
self.table_version_number._read()
|
|
1485
|
+
self._debug['table_version_number']['end'] = self._io.pos()
|
|
1486
|
+
self._debug['num_glyphs']['start'] = self._io.pos()
|
|
1487
|
+
self.num_glyphs = self._io.read_u2be()
|
|
1488
|
+
self._debug['num_glyphs']['end'] = self._io.pos()
|
|
1489
|
+
if self.is_version10:
|
|
1490
|
+
self._debug['version10_body']['start'] = self._io.pos()
|
|
1491
|
+
self.version10_body = Ttf.MaxpVersion10Body(self._io, self, self._root)
|
|
1492
|
+
self.version10_body._read()
|
|
1493
|
+
self._debug['version10_body']['end'] = self._io.pos()
|
|
1494
|
+
|
|
1495
|
+
|
|
1496
|
+
@property
|
|
1497
|
+
def is_version10(self):
|
|
1498
|
+
if hasattr(self, '_m_is_version10'):
|
|
1499
|
+
return self._m_is_version10 if hasattr(self, '_m_is_version10') else None
|
|
1500
|
+
|
|
1501
|
+
self._m_is_version10 = ((self.table_version_number.major == 1) and (self.table_version_number.minor == 0))
|
|
1502
|
+
return self._m_is_version10 if hasattr(self, '_m_is_version10') else None
|
|
1503
|
+
|
|
1504
|
+
|
|
1505
|
+
class MaxpVersion10Body(KaitaiStruct):
|
|
1506
|
+
SEQ_FIELDS = ["max_points", "max_contours", "max_composite_points", "max_composite_contours", "max_zones", "max_twilight_points", "max_storage", "max_function_defs", "max_instruction_defs", "max_stack_elements", "max_size_of_instructions", "max_component_elements", "max_component_depth"]
|
|
1507
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
1508
|
+
self._io = _io
|
|
1509
|
+
self._parent = _parent
|
|
1510
|
+
self._root = _root if _root else self
|
|
1511
|
+
self._debug = collections.defaultdict(dict)
|
|
1512
|
+
|
|
1513
|
+
def _read(self):
|
|
1514
|
+
self._debug['max_points']['start'] = self._io.pos()
|
|
1515
|
+
self.max_points = self._io.read_u2be()
|
|
1516
|
+
self._debug['max_points']['end'] = self._io.pos()
|
|
1517
|
+
self._debug['max_contours']['start'] = self._io.pos()
|
|
1518
|
+
self.max_contours = self._io.read_u2be()
|
|
1519
|
+
self._debug['max_contours']['end'] = self._io.pos()
|
|
1520
|
+
self._debug['max_composite_points']['start'] = self._io.pos()
|
|
1521
|
+
self.max_composite_points = self._io.read_u2be()
|
|
1522
|
+
self._debug['max_composite_points']['end'] = self._io.pos()
|
|
1523
|
+
self._debug['max_composite_contours']['start'] = self._io.pos()
|
|
1524
|
+
self.max_composite_contours = self._io.read_u2be()
|
|
1525
|
+
self._debug['max_composite_contours']['end'] = self._io.pos()
|
|
1526
|
+
self._debug['max_zones']['start'] = self._io.pos()
|
|
1527
|
+
self.max_zones = self._io.read_u2be()
|
|
1528
|
+
self._debug['max_zones']['end'] = self._io.pos()
|
|
1529
|
+
self._debug['max_twilight_points']['start'] = self._io.pos()
|
|
1530
|
+
self.max_twilight_points = self._io.read_u2be()
|
|
1531
|
+
self._debug['max_twilight_points']['end'] = self._io.pos()
|
|
1532
|
+
self._debug['max_storage']['start'] = self._io.pos()
|
|
1533
|
+
self.max_storage = self._io.read_u2be()
|
|
1534
|
+
self._debug['max_storage']['end'] = self._io.pos()
|
|
1535
|
+
self._debug['max_function_defs']['start'] = self._io.pos()
|
|
1536
|
+
self.max_function_defs = self._io.read_u2be()
|
|
1537
|
+
self._debug['max_function_defs']['end'] = self._io.pos()
|
|
1538
|
+
self._debug['max_instruction_defs']['start'] = self._io.pos()
|
|
1539
|
+
self.max_instruction_defs = self._io.read_u2be()
|
|
1540
|
+
self._debug['max_instruction_defs']['end'] = self._io.pos()
|
|
1541
|
+
self._debug['max_stack_elements']['start'] = self._io.pos()
|
|
1542
|
+
self.max_stack_elements = self._io.read_u2be()
|
|
1543
|
+
self._debug['max_stack_elements']['end'] = self._io.pos()
|
|
1544
|
+
self._debug['max_size_of_instructions']['start'] = self._io.pos()
|
|
1545
|
+
self.max_size_of_instructions = self._io.read_u2be()
|
|
1546
|
+
self._debug['max_size_of_instructions']['end'] = self._io.pos()
|
|
1547
|
+
self._debug['max_component_elements']['start'] = self._io.pos()
|
|
1548
|
+
self.max_component_elements = self._io.read_u2be()
|
|
1549
|
+
self._debug['max_component_elements']['end'] = self._io.pos()
|
|
1550
|
+
self._debug['max_component_depth']['start'] = self._io.pos()
|
|
1551
|
+
self.max_component_depth = self._io.read_u2be()
|
|
1552
|
+
self._debug['max_component_depth']['end'] = self._io.pos()
|
|
1553
|
+
|
|
1554
|
+
|
|
1555
|
+
class OffsetTable(KaitaiStruct):
|
|
1556
|
+
SEQ_FIELDS = ["sfnt_version", "num_tables", "search_range", "entry_selector", "range_shift"]
|
|
1557
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
1558
|
+
self._io = _io
|
|
1559
|
+
self._parent = _parent
|
|
1560
|
+
self._root = _root if _root else self
|
|
1561
|
+
self._debug = collections.defaultdict(dict)
|
|
1562
|
+
|
|
1563
|
+
def _read(self):
|
|
1564
|
+
self._debug['sfnt_version']['start'] = self._io.pos()
|
|
1565
|
+
self.sfnt_version = Ttf.Fixed(self._io, self, self._root)
|
|
1566
|
+
self.sfnt_version._read()
|
|
1567
|
+
self._debug['sfnt_version']['end'] = self._io.pos()
|
|
1568
|
+
self._debug['num_tables']['start'] = self._io.pos()
|
|
1569
|
+
self.num_tables = self._io.read_u2be()
|
|
1570
|
+
self._debug['num_tables']['end'] = self._io.pos()
|
|
1571
|
+
self._debug['search_range']['start'] = self._io.pos()
|
|
1572
|
+
self.search_range = self._io.read_u2be()
|
|
1573
|
+
self._debug['search_range']['end'] = self._io.pos()
|
|
1574
|
+
self._debug['entry_selector']['start'] = self._io.pos()
|
|
1575
|
+
self.entry_selector = self._io.read_u2be()
|
|
1576
|
+
self._debug['entry_selector']['end'] = self._io.pos()
|
|
1577
|
+
self._debug['range_shift']['start'] = self._io.pos()
|
|
1578
|
+
self.range_shift = self._io.read_u2be()
|
|
1579
|
+
self._debug['range_shift']['end'] = self._io.pos()
|
|
1580
|
+
|
|
1581
|
+
|
|
1582
|
+
class Cmap(KaitaiStruct):
|
|
1583
|
+
"""cmap - Character To Glyph Index Mapping Table This table defines the mapping of character codes to the glyph index values used in the font.
|
|
1584
|
+
"""
|
|
1585
|
+
SEQ_FIELDS = ["version_number", "number_of_encoding_tables", "tables"]
|
|
1586
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
1587
|
+
self._io = _io
|
|
1588
|
+
self._parent = _parent
|
|
1589
|
+
self._root = _root if _root else self
|
|
1590
|
+
self._debug = collections.defaultdict(dict)
|
|
1591
|
+
|
|
1592
|
+
def _read(self):
|
|
1593
|
+
self._debug['version_number']['start'] = self._io.pos()
|
|
1594
|
+
self.version_number = self._io.read_u2be()
|
|
1595
|
+
self._debug['version_number']['end'] = self._io.pos()
|
|
1596
|
+
self._debug['number_of_encoding_tables']['start'] = self._io.pos()
|
|
1597
|
+
self.number_of_encoding_tables = self._io.read_u2be()
|
|
1598
|
+
self._debug['number_of_encoding_tables']['end'] = self._io.pos()
|
|
1599
|
+
self._debug['tables']['start'] = self._io.pos()
|
|
1600
|
+
self.tables = [None] * (self.number_of_encoding_tables)
|
|
1601
|
+
for i in range(self.number_of_encoding_tables):
|
|
1602
|
+
if not 'arr' in self._debug['tables']:
|
|
1603
|
+
self._debug['tables']['arr'] = []
|
|
1604
|
+
self._debug['tables']['arr'].append({'start': self._io.pos()})
|
|
1605
|
+
_t_tables = Ttf.Cmap.SubtableHeader(self._io, self, self._root)
|
|
1606
|
+
_t_tables._read()
|
|
1607
|
+
self.tables[i] = _t_tables
|
|
1608
|
+
self._debug['tables']['arr'][i]['end'] = self._io.pos()
|
|
1609
|
+
|
|
1610
|
+
self._debug['tables']['end'] = self._io.pos()
|
|
1611
|
+
|
|
1612
|
+
class SubtableHeader(KaitaiStruct):
|
|
1613
|
+
SEQ_FIELDS = ["platform_id", "encoding_id", "subtable_offset"]
|
|
1614
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
1615
|
+
self._io = _io
|
|
1616
|
+
self._parent = _parent
|
|
1617
|
+
self._root = _root if _root else self
|
|
1618
|
+
self._debug = collections.defaultdict(dict)
|
|
1619
|
+
|
|
1620
|
+
def _read(self):
|
|
1621
|
+
self._debug['platform_id']['start'] = self._io.pos()
|
|
1622
|
+
self.platform_id = self._io.read_u2be()
|
|
1623
|
+
self._debug['platform_id']['end'] = self._io.pos()
|
|
1624
|
+
self._debug['encoding_id']['start'] = self._io.pos()
|
|
1625
|
+
self.encoding_id = self._io.read_u2be()
|
|
1626
|
+
self._debug['encoding_id']['end'] = self._io.pos()
|
|
1627
|
+
self._debug['subtable_offset']['start'] = self._io.pos()
|
|
1628
|
+
self.subtable_offset = self._io.read_u4be()
|
|
1629
|
+
self._debug['subtable_offset']['end'] = self._io.pos()
|
|
1630
|
+
|
|
1631
|
+
@property
|
|
1632
|
+
def table(self):
|
|
1633
|
+
if hasattr(self, '_m_table'):
|
|
1634
|
+
return self._m_table if hasattr(self, '_m_table') else None
|
|
1635
|
+
|
|
1636
|
+
io = self._parent._io
|
|
1637
|
+
_pos = io.pos()
|
|
1638
|
+
io.seek(self.subtable_offset)
|
|
1639
|
+
self._debug['_m_table']['start'] = io.pos()
|
|
1640
|
+
self._m_table = Ttf.Cmap.Subtable(io, self, self._root)
|
|
1641
|
+
self._m_table._read()
|
|
1642
|
+
self._debug['_m_table']['end'] = io.pos()
|
|
1643
|
+
io.seek(_pos)
|
|
1644
|
+
return self._m_table if hasattr(self, '_m_table') else None
|
|
1645
|
+
|
|
1646
|
+
|
|
1647
|
+
class Subtable(KaitaiStruct):
|
|
1648
|
+
|
|
1649
|
+
class SubtableFormat(Enum):
|
|
1650
|
+
byte_encoding_table = 0
|
|
1651
|
+
high_byte_mapping_through_table = 2
|
|
1652
|
+
segment_mapping_to_delta_values = 4
|
|
1653
|
+
trimmed_table_mapping = 6
|
|
1654
|
+
SEQ_FIELDS = ["format", "length", "version", "value"]
|
|
1655
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
1656
|
+
self._io = _io
|
|
1657
|
+
self._parent = _parent
|
|
1658
|
+
self._root = _root if _root else self
|
|
1659
|
+
self._debug = collections.defaultdict(dict)
|
|
1660
|
+
|
|
1661
|
+
def _read(self):
|
|
1662
|
+
self._debug['format']['start'] = self._io.pos()
|
|
1663
|
+
self.format = KaitaiStream.resolve_enum(Ttf.Cmap.Subtable.SubtableFormat, self._io.read_u2be())
|
|
1664
|
+
self._debug['format']['end'] = self._io.pos()
|
|
1665
|
+
self._debug['length']['start'] = self._io.pos()
|
|
1666
|
+
self.length = self._io.read_u2be()
|
|
1667
|
+
self._debug['length']['end'] = self._io.pos()
|
|
1668
|
+
self._debug['version']['start'] = self._io.pos()
|
|
1669
|
+
self.version = self._io.read_u2be()
|
|
1670
|
+
self._debug['version']['end'] = self._io.pos()
|
|
1671
|
+
self._debug['value']['start'] = self._io.pos()
|
|
1672
|
+
_on = self.format
|
|
1673
|
+
if _on == Ttf.Cmap.Subtable.SubtableFormat.byte_encoding_table:
|
|
1674
|
+
self._raw_value = self._io.read_bytes((self.length - 6))
|
|
1675
|
+
_io__raw_value = KaitaiStream(BytesIO(self._raw_value))
|
|
1676
|
+
self.value = Ttf.Cmap.Subtable.ByteEncodingTable(_io__raw_value, self, self._root)
|
|
1677
|
+
self.value._read()
|
|
1678
|
+
elif _on == Ttf.Cmap.Subtable.SubtableFormat.segment_mapping_to_delta_values:
|
|
1679
|
+
self._raw_value = self._io.read_bytes((self.length - 6))
|
|
1680
|
+
_io__raw_value = KaitaiStream(BytesIO(self._raw_value))
|
|
1681
|
+
self.value = Ttf.Cmap.Subtable.SegmentMappingToDeltaValues(_io__raw_value, self, self._root)
|
|
1682
|
+
self.value._read()
|
|
1683
|
+
elif _on == Ttf.Cmap.Subtable.SubtableFormat.high_byte_mapping_through_table:
|
|
1684
|
+
self._raw_value = self._io.read_bytes((self.length - 6))
|
|
1685
|
+
_io__raw_value = KaitaiStream(BytesIO(self._raw_value))
|
|
1686
|
+
self.value = Ttf.Cmap.Subtable.HighByteMappingThroughTable(_io__raw_value, self, self._root)
|
|
1687
|
+
self.value._read()
|
|
1688
|
+
elif _on == Ttf.Cmap.Subtable.SubtableFormat.trimmed_table_mapping:
|
|
1689
|
+
self._raw_value = self._io.read_bytes((self.length - 6))
|
|
1690
|
+
_io__raw_value = KaitaiStream(BytesIO(self._raw_value))
|
|
1691
|
+
self.value = Ttf.Cmap.Subtable.TrimmedTableMapping(_io__raw_value, self, self._root)
|
|
1692
|
+
self.value._read()
|
|
1693
|
+
else:
|
|
1694
|
+
self.value = self._io.read_bytes((self.length - 6))
|
|
1695
|
+
self._debug['value']['end'] = self._io.pos()
|
|
1696
|
+
|
|
1697
|
+
class ByteEncodingTable(KaitaiStruct):
|
|
1698
|
+
SEQ_FIELDS = ["glyph_id_array"]
|
|
1699
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
1700
|
+
self._io = _io
|
|
1701
|
+
self._parent = _parent
|
|
1702
|
+
self._root = _root if _root else self
|
|
1703
|
+
self._debug = collections.defaultdict(dict)
|
|
1704
|
+
|
|
1705
|
+
def _read(self):
|
|
1706
|
+
self._debug['glyph_id_array']['start'] = self._io.pos()
|
|
1707
|
+
self.glyph_id_array = self._io.read_bytes(256)
|
|
1708
|
+
self._debug['glyph_id_array']['end'] = self._io.pos()
|
|
1709
|
+
|
|
1710
|
+
|
|
1711
|
+
class HighByteMappingThroughTable(KaitaiStruct):
|
|
1712
|
+
SEQ_FIELDS = ["sub_header_keys"]
|
|
1713
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
1714
|
+
self._io = _io
|
|
1715
|
+
self._parent = _parent
|
|
1716
|
+
self._root = _root if _root else self
|
|
1717
|
+
self._debug = collections.defaultdict(dict)
|
|
1718
|
+
|
|
1719
|
+
def _read(self):
|
|
1720
|
+
self._debug['sub_header_keys']['start'] = self._io.pos()
|
|
1721
|
+
self.sub_header_keys = [None] * (256)
|
|
1722
|
+
for i in range(256):
|
|
1723
|
+
if not 'arr' in self._debug['sub_header_keys']:
|
|
1724
|
+
self._debug['sub_header_keys']['arr'] = []
|
|
1725
|
+
self._debug['sub_header_keys']['arr'].append({'start': self._io.pos()})
|
|
1726
|
+
self.sub_header_keys[i] = self._io.read_u2be()
|
|
1727
|
+
self._debug['sub_header_keys']['arr'][i]['end'] = self._io.pos()
|
|
1728
|
+
|
|
1729
|
+
self._debug['sub_header_keys']['end'] = self._io.pos()
|
|
1730
|
+
|
|
1731
|
+
|
|
1732
|
+
class SegmentMappingToDeltaValues(KaitaiStruct):
|
|
1733
|
+
SEQ_FIELDS = ["seg_count_x2", "search_range", "entry_selector", "range_shift", "end_count", "reserved_pad", "start_count", "id_delta", "id_range_offset", "glyph_id_array"]
|
|
1734
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
1735
|
+
self._io = _io
|
|
1736
|
+
self._parent = _parent
|
|
1737
|
+
self._root = _root if _root else self
|
|
1738
|
+
self._debug = collections.defaultdict(dict)
|
|
1739
|
+
|
|
1740
|
+
def _read(self):
|
|
1741
|
+
self._debug['seg_count_x2']['start'] = self._io.pos()
|
|
1742
|
+
self.seg_count_x2 = self._io.read_u2be()
|
|
1743
|
+
self._debug['seg_count_x2']['end'] = self._io.pos()
|
|
1744
|
+
self._debug['search_range']['start'] = self._io.pos()
|
|
1745
|
+
self.search_range = self._io.read_u2be()
|
|
1746
|
+
self._debug['search_range']['end'] = self._io.pos()
|
|
1747
|
+
self._debug['entry_selector']['start'] = self._io.pos()
|
|
1748
|
+
self.entry_selector = self._io.read_u2be()
|
|
1749
|
+
self._debug['entry_selector']['end'] = self._io.pos()
|
|
1750
|
+
self._debug['range_shift']['start'] = self._io.pos()
|
|
1751
|
+
self.range_shift = self._io.read_u2be()
|
|
1752
|
+
self._debug['range_shift']['end'] = self._io.pos()
|
|
1753
|
+
self._debug['end_count']['start'] = self._io.pos()
|
|
1754
|
+
self.end_count = [None] * (self.seg_count)
|
|
1755
|
+
for i in range(self.seg_count):
|
|
1756
|
+
if not 'arr' in self._debug['end_count']:
|
|
1757
|
+
self._debug['end_count']['arr'] = []
|
|
1758
|
+
self._debug['end_count']['arr'].append({'start': self._io.pos()})
|
|
1759
|
+
self.end_count[i] = self._io.read_u2be()
|
|
1760
|
+
self._debug['end_count']['arr'][i]['end'] = self._io.pos()
|
|
1761
|
+
|
|
1762
|
+
self._debug['end_count']['end'] = self._io.pos()
|
|
1763
|
+
self._debug['reserved_pad']['start'] = self._io.pos()
|
|
1764
|
+
self.reserved_pad = self._io.read_u2be()
|
|
1765
|
+
self._debug['reserved_pad']['end'] = self._io.pos()
|
|
1766
|
+
self._debug['start_count']['start'] = self._io.pos()
|
|
1767
|
+
self.start_count = [None] * (self.seg_count)
|
|
1768
|
+
for i in range(self.seg_count):
|
|
1769
|
+
if not 'arr' in self._debug['start_count']:
|
|
1770
|
+
self._debug['start_count']['arr'] = []
|
|
1771
|
+
self._debug['start_count']['arr'].append({'start': self._io.pos()})
|
|
1772
|
+
self.start_count[i] = self._io.read_u2be()
|
|
1773
|
+
self._debug['start_count']['arr'][i]['end'] = self._io.pos()
|
|
1774
|
+
|
|
1775
|
+
self._debug['start_count']['end'] = self._io.pos()
|
|
1776
|
+
self._debug['id_delta']['start'] = self._io.pos()
|
|
1777
|
+
self.id_delta = [None] * (self.seg_count)
|
|
1778
|
+
for i in range(self.seg_count):
|
|
1779
|
+
if not 'arr' in self._debug['id_delta']:
|
|
1780
|
+
self._debug['id_delta']['arr'] = []
|
|
1781
|
+
self._debug['id_delta']['arr'].append({'start': self._io.pos()})
|
|
1782
|
+
self.id_delta[i] = self._io.read_u2be()
|
|
1783
|
+
self._debug['id_delta']['arr'][i]['end'] = self._io.pos()
|
|
1784
|
+
|
|
1785
|
+
self._debug['id_delta']['end'] = self._io.pos()
|
|
1786
|
+
self._debug['id_range_offset']['start'] = self._io.pos()
|
|
1787
|
+
self.id_range_offset = [None] * (self.seg_count)
|
|
1788
|
+
for i in range(self.seg_count):
|
|
1789
|
+
if not 'arr' in self._debug['id_range_offset']:
|
|
1790
|
+
self._debug['id_range_offset']['arr'] = []
|
|
1791
|
+
self._debug['id_range_offset']['arr'].append({'start': self._io.pos()})
|
|
1792
|
+
self.id_range_offset[i] = self._io.read_u2be()
|
|
1793
|
+
self._debug['id_range_offset']['arr'][i]['end'] = self._io.pos()
|
|
1794
|
+
|
|
1795
|
+
self._debug['id_range_offset']['end'] = self._io.pos()
|
|
1796
|
+
self._debug['glyph_id_array']['start'] = self._io.pos()
|
|
1797
|
+
self.glyph_id_array = []
|
|
1798
|
+
i = 0
|
|
1799
|
+
while not self._io.is_eof():
|
|
1800
|
+
if not 'arr' in self._debug['glyph_id_array']:
|
|
1801
|
+
self._debug['glyph_id_array']['arr'] = []
|
|
1802
|
+
self._debug['glyph_id_array']['arr'].append({'start': self._io.pos()})
|
|
1803
|
+
self.glyph_id_array.append(self._io.read_u2be())
|
|
1804
|
+
self._debug['glyph_id_array']['arr'][len(self.glyph_id_array) - 1]['end'] = self._io.pos()
|
|
1805
|
+
i += 1
|
|
1806
|
+
|
|
1807
|
+
self._debug['glyph_id_array']['end'] = self._io.pos()
|
|
1808
|
+
|
|
1809
|
+
@property
|
|
1810
|
+
def seg_count(self):
|
|
1811
|
+
if hasattr(self, '_m_seg_count'):
|
|
1812
|
+
return self._m_seg_count if hasattr(self, '_m_seg_count') else None
|
|
1813
|
+
|
|
1814
|
+
self._m_seg_count = self.seg_count_x2 // 2
|
|
1815
|
+
return self._m_seg_count if hasattr(self, '_m_seg_count') else None
|
|
1816
|
+
|
|
1817
|
+
|
|
1818
|
+
class TrimmedTableMapping(KaitaiStruct):
|
|
1819
|
+
SEQ_FIELDS = ["first_code", "entry_count", "glyph_id_array"]
|
|
1820
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
1821
|
+
self._io = _io
|
|
1822
|
+
self._parent = _parent
|
|
1823
|
+
self._root = _root if _root else self
|
|
1824
|
+
self._debug = collections.defaultdict(dict)
|
|
1825
|
+
|
|
1826
|
+
def _read(self):
|
|
1827
|
+
self._debug['first_code']['start'] = self._io.pos()
|
|
1828
|
+
self.first_code = self._io.read_u2be()
|
|
1829
|
+
self._debug['first_code']['end'] = self._io.pos()
|
|
1830
|
+
self._debug['entry_count']['start'] = self._io.pos()
|
|
1831
|
+
self.entry_count = self._io.read_u2be()
|
|
1832
|
+
self._debug['entry_count']['end'] = self._io.pos()
|
|
1833
|
+
self._debug['glyph_id_array']['start'] = self._io.pos()
|
|
1834
|
+
self.glyph_id_array = [None] * (self.entry_count)
|
|
1835
|
+
for i in range(self.entry_count):
|
|
1836
|
+
if not 'arr' in self._debug['glyph_id_array']:
|
|
1837
|
+
self._debug['glyph_id_array']['arr'] = []
|
|
1838
|
+
self._debug['glyph_id_array']['arr'].append({'start': self._io.pos()})
|
|
1839
|
+
self.glyph_id_array[i] = self._io.read_u2be()
|
|
1840
|
+
self._debug['glyph_id_array']['arr'][i]['end'] = self._io.pos()
|
|
1841
|
+
|
|
1842
|
+
self._debug['glyph_id_array']['end'] = self._io.pos()
|
|
1843
|
+
|
|
1844
|
+
|
|
1845
|
+
|
|
1846
|
+
|
|
1847
|
+
|