fontBuilder: allow to build v1 from setupCPAL method

This commit is contained in:
Cosimo Lupo 2020-02-17 18:35:15 +00:00
parent a0a4901a5e
commit d9250ddcf5
No known key found for this signature in database
GPG Key ID: 20D4A261E4A0E642

View File

@ -777,14 +777,29 @@ class FontBuilder(object):
self.font["COLR"] = buildCOLR(colorLayers)
def setupCPAL(self, palettes):
def setupCPAL(
self,
palettes,
paletteTypes=None,
paletteLabels=None,
paletteEntryLabels=None,
):
"""Build new CPAL table using list of palettes.
Optionally build CPAL v1 table using paletteTypes, paletteLabels and
paletteEntryLabels.
Cf. `fontTools.colorLib.builder.buildCPAL`.
"""
from fontTools.colorLib.builder import buildCPAL
self.font["CPAL"] = buildCPAL(palettes)
self.font["CPAL"] = buildCPAL(
palettes,
paletteTypes=paletteTypes,
paletteLabels=paletteLabels,
paletteEntryLabels=paletteEntryLabels,
nameTable=self.font.get("name")
)
def buildCmapSubTable(cmapping, format, platformID, platEncID):