Skip to content

Commit

Permalink
colr_to_svg: use the first palette and warn when len(CPAL.palettes) > 1
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed Aug 18, 2022
1 parent de3147e commit 6e8e43c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/nanoemoji/colr_to_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,13 @@ def colr_to_svg(
rounding_ndigits: Optional[int] = None,
) -> Dict[str, SVG]:
"""For testing only, don't use for real!"""
assert len(ttfont["CPAL"].palettes) == 1, "We assume one palette"
num_palettes = len(ttfont["CPAL"].palettes)
if num_palettes > 1:
logging.warning(
"Multiple CPAL palettes are not supported! Only using the first"
)
elif num_palettes < 1:
raise ValueError("No CPAL palettes found, at least one required")

colr_version = ttfont["COLR"].version
if colr_version == 0:
Expand Down

0 comments on commit 6e8e43c

Please sign in to comment.