Hello,
I have implemented basic .docx support for embedded fonts, which temporarily
adds the embedded fonts to the list of fonts used by the running LO instance,
but I struggle to actually propagate the change to all parts of LO. While for
example rendering the actual documents works (because the fonts are added
before the document is created), I cannot find a reasonably good way of
updating e.g. the font combobox or the RMB->Character dialog.
The problems seem to stem from the fact that some font information is cached
per OutputDevice and that SwDocShell has a font list as well
(SID_ATTR_CHAR_FONTLIST). I'm unsure how to tell these to refresh their
information.
Actual adding of the font is done using OutputDevice::AddTempDevFont(), which
however updates only the one OutputDevice instance. I've also added a call to
OutputDevice::ImplUpdateAllFontData(), but that one
- triggers a warning in ImplFontCache::Invalidate() about the font items
refcount not being zero, because some of the fonts are already used by the
time of the call. Looking at the assert, I would intuitively say it is bogus,
since a cache shouldn't care if some of its cached items are also used
elsewhere, and remove the assert. However, not being quite new to this
codebase anymore, I can't rule out that e.g. the ImplFontCache class is not
actually a font cache and therefore the Invalidate() function not only needs
to invalidate the stored items but also delete them for whatever reason.
- does not really work until I change the "if ( GetOutDevType() ==
OUTDEV_PRINTER || mpPDFWriter )" condition in
OutputDevice::ImplUpdateFontData() to "if( true )" to actually update the
font information stored in OutputDevices. Repo history does not help and I
have no idea why that font information updating should happen only in those
selected cases.
I've tried also propagating a DATACHANGED_FONTS event (similarly like done in
OutputDevice::EndFontSubstitution()) to update information, but that doesn't
work for the SwDocShell case, because it is not a window, therefore it
doesn't get the event (as far as I understand this). The embedded fonts are
added after SwDocShell for the document is created but before SwEditWin
(which I think would get the event) for the document is created, so
SwDocShell has the old font list.
Does somebody have any idea about any of these?
--
Lubos Lunak
l.lunak@suse.cz
Context
- Added fonts while LO is running - propagating the changes · Lubos Lunak
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.