It would be a great help if there was the opportunity to register a font from outside of the svglib in the same way it is possible in the included reportlab module.
Right now a font has to be in the folder ~/.fonts and the string for the font that should be registered has to be exact the same like the file with the .tff extension.
At the moment, it is possible to check if a font will be found, with svg.find_font(font_name). Inside of this function the registerFont function is used from reportlab like this registerFont(TTFont(font_name, '%s.ttf' % font_name)).
The downside of thie is, that there is no chance to modify the name of the font to use on the on hand and the path of the folder on the other hand.
In the example below, the reportlab module shows the wanted behavior.
from reportlab.pdfbase.ttfonts import TTFError, TTFont
from reportlab.pdfbase.pdfmetrics import registerFont
font_name = 'SourceSansPro'
path_string = '/home/fonts/SourceSansPro-Regular.ttf'
registerFont(TTFont(font_name, path_string))
The wish would be, that svglib gives the user the opportunity to register a font before futher actions.
It would be a great help if there was the opportunity to register a font from outside of the svglib in the same way it is possible in the included
reportlab
module.Right now a font has to be in the folder
~/.fonts
and the string for the font that should be registered has to be exact the same like the file with the.tff
extension.At the moment, it is possible to check if a font will be found, with
svg.find_font(font_name)
. Inside of this function theregisterFont
function is used fromreportlab
like thisregisterFont(TTFont(font_name, '%s.ttf' % font_name))
.The downside of thie is, that there is no chance to modify the name of the font to use on the on hand and the path of the folder on the other hand.
In the example below, the
reportlab
module shows the wanted behavior.The wish would be, that
svglib
gives the user the opportunity to register a font before futher actions.