lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Add ly:get-font-format to get the font format (issue 296350043 by addres


From: lemzwerg
Subject: Add ly:get-font-format to get the font format (issue 296350043 by address@hidden)
Date: Fri, 03 Jun 2016 13:06:48 -0700

You were faster than me :-)

LGTM, but note that FreeType's `FT_Get_Font_Format` doesn't really
return the font format but the name of the module used to handle a font.
 In particular, it doesn't make a difference between PFA and PFB.

While I haven't started coding yet, I've played around to write a
documentation string first.  Here is what I cooked up yesterday.

LY_DEFINE (ly_font_format_for_conversion,
"ly:font-format-for-conversion",
           1, 0, 0,
           (SCM font_file_name),
           "Return the font format of the font file as a symbol,
indicating"
           " how to convert it to a resource that can be embedded into
a"
           " PostScript output file as created by LilyPond.  Possible
values"
           " are @code{'TrueType}, @code{'PFA}, @code{'PFB},
@code{'Type42},"
           " @code{'CID}, @code{'CFF}, and @code{'OTF}.  If the font
format"
           " is not recognized or not supported, @code{'()} gets
returned.\n"
           "\n"
           "Fonts tagged as @code{'TrueType} can be converted to a"
           " PostScript address@hidden font resource with function"
           " @code{ly:ttf->pfa}.  @code{'PFB} is a binary address@hidden
font"
           " that must be converted to a address@hidden font resource with"

           " function @code{ly:pfb->pfa}.  @code{'OTF} indicates a CFF"
           " contained in an SFNT wrapper; it should be converted to a
bare"
           " CFF with function @code{ly:otf->cff}.\n"
           "\n"
           "Bare CFFs (tagged as @code{'CFF}) should be converted to an"
           " embeddable resource with function @code{ps-embed-cff}.
ASCII"
           " address@hidden fonts (tagged as @code{'PFA}) should be
converted"
           " to embeddable resources with function
@code{embed-document}."
           "\n"
           "Bare CID and address@hidden font resources (tagged as
@code{'CID}"
           " and @code{'Type42}, respectively) can be directly embedded"
           " into the output.")

Such a function could be then used to rewrite `font-file-as-ps-string`
to avoid any dependency on the file extension.



https://codereview.appspot.com/296350043/diff/1/lily/open-type-font-scheme.cc
File lily/open-type-font-scheme.cc (right):

https://codereview.appspot.com/296350043/diff/1/lily/open-type-font-scheme.cc#newcode133
lily/open-type-font-scheme.cc:133: " returning it as a string.  The
optional"
Wouldn't it be better to return a symbol instead?

https://codereview.appspot.com/296350043/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]