Skip to content

Commit

Permalink
add blob.length property
Browse files Browse the repository at this point in the history
  • Loading branch information
mcratt committed Dec 20, 2024
1 parent 77b827e commit 63fc5b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/uharfbuzz/_harfbuzz.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,9 @@ cdef class Blob:
def data(self) -> bytes:
return self._data

@property
def length(self) -> int:
return hb_blob_get_length(self._hb_blob)

class OTVarAxisFlags(IntFlag):
HIDDEN = HB_OT_VAR_AXIS_FLAG_HIDDEN
Expand Down
3 changes: 3 additions & 0 deletions tests/test_uharfbuzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ def test_from_file_path_fail(self):
with pytest.raises(hb.HarfBuzzError, match="Failed to open: DOES-NOT-EXIST"):
blob = hb.Blob.from_file_path("DOES-NOT-EXIST")

def test_length(self, blankfont):
face = blankfont.face
assert face.blob.length == 1892

class TestFace:
def test_properties(self, blankfont):
Expand Down

0 comments on commit 63fc5b3

Please sign in to comment.