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 Type@tie{}42 font resource with function" " @code{ly:ttf->pfa}. @code{'PFB} is a binary Type@tie{}1 font" " that must be converted to a Type@tie{}1 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" " Type@tie{}1 fonts (tagged as @code{'PFA}) should be converted" " to embeddable resources with function @code{embed-document}." "\n" "Bare CID and Type@tie{}42 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/ _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel