File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 11from pathlib import Path
22from pango cimport *
33import copy
4+ import os
45
56cpdef bint fc_register_font(str font_path):
67 """ This function registers the font file using ``fontconfig`` so that
@@ -27,9 +28,9 @@ cpdef bint fc_register_font(str font_path):
2728 AssertionError
2829 Font is missing.
2930 """
30- a= Path(font_path)
31+ a = Path(font_path)
3132 assert a.exists(), f" font doesn't exist at {a.absolute()}"
32- font_path = str (a.absolute())
33+ font_path = os.fspath (a.absolute())
3334 font_path_bytes= font_path.encode(' utf-8' )
3435 cdef const unsigned char * fontPath = font_path_bytes
3536 fontAddStatus = FcConfigAppFontAddFile(FcConfigGetCurrent(), fontPath)
@@ -93,7 +94,7 @@ ELIF UNAME_SYSNAME == "Windows":
9394 """
9495 a= Path(font_path)
9596 assert a.exists(), f" font doesn't exist at {a.absolute()}"
96- font_path = str (a.absolute())
97+ font_path = os.fspath (a.absolute())
9798 fontAddStatus = AddFontResourceExW(
9899 < bytes> font_path,
99100 FR_PRIVATE,
@@ -125,7 +126,7 @@ ELIF UNAME_SYSNAME == "Windows":
125126 """
126127 a= Path(font_path)
127128 assert a.exists(), f" font doesn't exist at {a.absolute()}"
128- font_path = str (a.absolute())
129+ font_path = os.fspath (a.absolute())
129130 return RemoveFontResourceExW(
130131 < bytes> font_path,
131132 FR_PRIVATE,
You can’t perform that action at this time.
0 commit comments