Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve setting woffMetaDataDescription #26

Open
typemytype opened this issue Jan 23, 2019 · 5 comments
Open

improve setting woffMetaDataDescription #26

typemytype opened this issue Jan 23, 2019 · 5 comments

Comments

@typemytype
Copy link
Member

when setting the url field and no text is set it fails hard

see https://forum.robofont.com/topic/566/fontinfo-woff-description-url

@typemytype
Copy link
Member Author

the ufoLib woffMetadataDescription validator requires both url as text keys, only one is provided while setting the url value.

maybe the validator must be less strict on requiring the text keyword, see https://github.com/anthrotype/ufoLib/blob/master/Lib/ufoLib/validators.py#L378

other woff info attributes dont require the text keyword (see fontInfoWOFFMetadataLicenseValidator) which is basically the same from data structure.

Should I open an issue on fontTools.ufoLib?

@typesupply @anthrotype

@typemytype
Copy link
Member Author

the patch could be:

(replaces https://github.com/anthrotype/ufoLib/blob/master/Lib/ufoLib/validators.py#L374-L384 )

def fontInfoWOFFMetadataDescriptionValidator(value):
	"""
	Version 3+.
	"""
	dictPrototype = dict(url=(basestring, False), text=(list, False))
	if not genericDictValidator(value, dictPrototype):
		return False
	if "text" in value:
		for text in value["text"]:
			if not fontInfoWOFFMetadataTextValue(text):
				return False
	return True

I can make an fontTool PR if you like

@typemytype
Copy link
Member Author

closing the issue here in as this has moved to fontTools ufoLib

fonttools/fonttools#1471

@benkiel
Copy link
Member

benkiel commented Jan 28, 2019

Reading the WOFF spec, the url element is optional, but one or more text elements is required if setting the description element.

@typemytype typemytype reopened this Jan 28, 2019
@typemytype
Copy link
Member Author

need to refactor the woffMetaDataDescription control:

options are (the problem is you can not set multiple things at the same time, since that is galaxtically in space and time just not possible):

  • add default entry when a url is given?
  • only set the url when there is entry?
  • the url is as default disabled as long as text is empty (so nothing can be set)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants