I am using XMLWorker for parsing html. I have been having some issues with the fonts I define in the styles. For example, something simple as this:
<span style="font-family: Garamond">Foo Garamond</span>
wasn't not working.
I was using this as my css applier:
CssAppliers ca = new CssAppliersImpl();
In order to check if it was a problem with the encoding of the html, or any other issue..., I did my own implementation of the IFontProvider:
class MyFontProvider : IFontProvider
{
public bool IsRegistered(string fontname)
{
return false;
}
public Font GetFont(string fontname, string encoding, bool embedded, float size, int style, BaseColor color)
{
var font = FontFactory.GetFont(fontname, encoding, embedded, size, style, color);
return new Font(font);
}
}
Then, this:
CssAppliers ca = new CssAppliersImpl(new MyFontProvider());
Great!!!, that works fine!!!, also if I passed to the constructor this:
CssAppliers ca = new CssAppliersImpl(new XMLWorkerFontProvider());
also works.
So, it is obvious that the default implementation of the font provider is not working. I defined it as this:
CssAppliers ca = new CssAppliersImpl();
or
CssAppliers ca = new CssAppliersImpl(new FontFactoryImp());
, and neither worked.
My questions are:
- What possible explanation has this?
- Differences between
XMLWorkerFontProvider
andFontFactoryImp
implementations