C# Class Bloom.Publish.FontFileFinder

This class handles the problem of finding what files contain the definition of the various faces of a particular font. So far the best approach involves a scan of the whole font directory, so it is much more efficient to build a dictionary once, or at least once per operation that uses it. The dictionary and method could be static, but then, we would miss the chance to find any new fonts added since the last operation that needed this information.
Show file Open project: BloomBooks/BloomDesktop Class Usage Examples

Private Properties

Property Type Description
FindLinuxFonts IEnumerable
FindLinuxFonts IEnumerable

Public Methods

Method Description
GetFilesForFont ( string fontName ) : IEnumerable

This is really hard. We somehow need to figure out what font file(s) are used for a particular font. http://stackoverflow.com/questions/16769758/get-a-font-filename-based-on-the-font-handle-hfont has some ideas; the result would be Windows-specific. And at some point we should ideally consider what faces are needed. For now we use brute force. 'Andika New Basic' -> AndikaNewBasic-{R,B,I,BI}.ttf Arial -> arial.ttf/ariali.ttf/arialbd.ttf/arialbi.ttf 'Charis SIL' -> CharisSIL{R,B,I,BI}.ttf (note: no hyphen) Doulos SIL -> DoulosSILR

GetGroupForFont ( string fontName ) : FontGroup

Private Methods

Method Description
FindLinuxFonts ( ) : IEnumerable
FindLinuxFonts ( string folder ) : IEnumerable

Method Details

GetFilesForFont() public method

This is really hard. We somehow need to figure out what font file(s) are used for a particular font. http://stackoverflow.com/questions/16769758/get-a-font-filename-based-on-the-font-handle-hfont has some ideas; the result would be Windows-specific. And at some point we should ideally consider what faces are needed. For now we use brute force. 'Andika New Basic' -> AndikaNewBasic-{R,B,I,BI}.ttf Arial -> arial.ttf/ariali.ttf/arialbd.ttf/arialbi.ttf 'Charis SIL' -> CharisSIL{R,B,I,BI}.ttf (note: no hyphen) Doulos SIL -> DoulosSILR
public GetFilesForFont ( string fontName ) : IEnumerable
fontName string
return IEnumerable

GetGroupForFont() public method

public GetGroupForFont ( string fontName ) : FontGroup
fontName string
return FontGroup