File tree 2 files changed +26
-0
lines changed
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ with open("fonts/MyFont.ttf") as fh:
71
71
- [ ` get_vertical_metrics ` ] ( #get_vertical_metrics )
72
72
- [ ` get_weight ` ] ( #get_weight )
73
73
- [ ` get_width ` ] ( #get_width )
74
+ - [ ` is_color ` ] ( #is_color )
74
75
- [ ` is_monospace ` ] ( #is_monospace )
75
76
- [ ` is_static ` ] ( #is_static )
76
77
- [ ` is_variable ` ] ( #is_variable )
@@ -580,6 +581,17 @@ Gets the font width value and name.
580
581
width = font.get_width()
581
582
```
582
583
584
+ #### ` is_color `
585
+ ``` python
586
+ """
587
+ Determines if the font is a color font.
588
+
589
+ :returns: True if color font, False otherwise.
590
+ :rtype: bool
591
+ """
592
+ color = font.is_color()
593
+ ```
594
+
583
595
#### ` is_monospace `
584
596
``` python
585
597
"""
Original file line number Diff line number Diff line change @@ -1451,6 +1451,20 @@ def get_width(
1451
1451
width ["value" ] = width_value
1452
1452
return width
1453
1453
1454
+ def is_color (self ) -> bool :
1455
+ """
1456
+ Determines if the font is a color font.
1457
+
1458
+ :returns: True if color font, False otherwise.
1459
+ :rtype: bool
1460
+ """
1461
+ font = self .get_ttfont ()
1462
+ tables = {"COLR" , "CPAL" , "CBDT" , "CBLC" }
1463
+ for table in tables :
1464
+ if table in font :
1465
+ return True
1466
+ return False
1467
+
1454
1468
def is_monospace (
1455
1469
self ,
1456
1470
threshold : float = 0.85 ,
You can’t perform that action at this time.
0 commit comments