Created attachment 57635 [details] [review] add parameter "now" to updateFont() swftools has a tool to convert pdf to swf (Flash) files. To do this, it uses a patched xpdf instance. For debian i try to port swftools to poppler, but swftools needs some code, that is not available in poppler. So please add the following patch to poppler. It adds a second parameter "now" to updateFont() that forces the immidate update of font configuration without need to call drawChar(). Alternatively it would be ok for me if needFontUpdate and doFontUpdate() are made public or a new public function gets added, that has this meaning.
******* Alternatively it would be ok for me if needFontUpdate and doFontUpdate() are made public or a new public function gets added, that has this meaning. ******* There is no doFontUpdate() in poppler, i'm confused.
Dammit, i always get it the wrong way... i'm talking about void SplashOutputDev::doUpdateFont(GfxState *state);
To be honest i don't see your use case, are you inheriting from SplashOutputDev?
swftools implements an own class InfoOutputDev. That one is not derived from SplashOutputDev, but creates instances of it to render pdf to flash swf. It needs to retrieve the current splash font without actually drawing some text (with is currently required to get the font info updated). So it patches the (embedded) xpdf code to make doUpdateFont() public. Its an hack... For porting swftools to poppler there must be a method to get the same functionality without hacking... Some snipped of code from swftools: void InfoOutputDev::updateFont(GfxState *state) { GfxFont*font = state->getFont(); if(!font) { current_splash_font = 0; return; } if(font->getType() == fontType3) { current_splash_font = 0; return; } GfxState* state2 = state->copy(); state2->setPath(0); state2->setCTM(1.0,0,0,1.0,0,0); splash->updateCTM(state2, 0,0,0,0,0,0); state2->setTextMat(1.0,0,0,1.0,0,0); state2->setFont(font, 1024.0); splash->doUpdateFont(state2); current_splash_font = splash->getCurrentFont(); delete state2; }
To be honest i don't like any of the solutions (actually your first one is broken), moreover we don't recommend people using poppler internals as we change them as we see fit to make stuff better, so you requiring this change in the headers means we need to "keep" this API for you in the internal headers and we don't want to have anything tying us in the internal header. You should really look into a way of doing this wihtout requiring any poppler code change. But as a compromise solution i can make doUpdateFont protected. Then you make a class yourself that inherits from SplashOutputDev and has a function that calls doUpdateFont. But note that as said we will change this function if we need it. Deal?
Sorry, i was busy lately. I would like to make this working in a way without poppler changes. But i have no idea how to do it. So yes, it would be fine, if you make it protected and i will try to solve my problems by my oen subclass.
Function made protected
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.