Bug 77878 - Fonts hidden in Windows Control Panel continue to be displayed in font list
Summary: Fonts hidden in Windows Control Panel continue to be displayed in font list
Status: REOPENED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
4.3.0.0.alpha0+ Master
Hardware: Other Windows (All)
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevAdvice
Depends on:
Blocks: Font-List
  Show dependency treegraph
 
Reported: 2014-04-24 08:27 UTC by Urmas
Modified: 2020-10-01 08:35 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Urmas 2014-04-24 08:27:42 UTC
LibreOffice does not respect the user preference for hiding fonts via Windows Control Panel.
Comment 1 Jorendc 2014-07-16 20:48:11 UTC
Sounds like a valid enhancement request to me -> NEW.

Kind regards,
Joren
Comment 2 Yousuf Philips (jay) (retired) 2015-10-09 09:08:23 UTC
Not so sure if we should be supporting such a feature when MSDN states, "In Windows 7, there are no APIs for directly querying which fonts are hidden, or for setting fonts to be hidden."

https://msdn.microsoft.com/en-us/library/dd317704(VS.85,loband).aspx
http://loseyourmind.com/Why-hide-fonts-does-not-work-with-windows-7.aspx
Comment 3 Robinson Tryon (qubit) 2016-08-25 05:39:26 UTC Comment hidden (obsolete)
Comment 4 Heiko Tietze 2017-09-21 13:26:35 UTC
Not a UX question to me. Following comment 2 it's "not our bug", but keeping it open for dev eval.
Comment 5 ⁨خالد حسني⁩ 2018-02-02 06:52:20 UTC
NOTOURBUG per comment 2.
Comment 6 R. Green 2020-09-04 10:26:43 UTC
This bug applies to Windows 10 as well: at least in Writer. Changing title to reflect this.
Comment 7 João Paulo 2020-09-29 04:07:34 UTC
(In reply to Yousuf Philips (jay) (retired) from comment #2)
> Not so sure if we should be supporting such a feature when MSDN states, "In
> Windows 7, there are no APIs for directly querying which fonts are hidden,
> or for setting fonts to be hidden."
> 
> https://msdn.microsoft.com/en-us/library/dd317704(VS.85,loband).aspx
> http://loseyourmind.com/Why-hide-fonts-does-not-work-with-windows-7.aspx

(In reply to Khaled Hosny from comment #5)
> NOTOURBUG per comment 2.

I think it is something LibreOffice could do better.  On the first link, which redirects to https://docs.microsoft.com/pt-br/windows/win32/intl/about-international-fonts-and-text, even if it states there are no APIs on Windows 7 (and maybe up) to directly query which fonts are hidden, it also says that "If you use the Windows ChooseFont API (Font common dialog) to enable font selection today, you will get the new behavior [for hiding fonts] for free."

The ChooseFont API also accepts templates so the dialog can be customized:  See "https://docs.microsoft.com/en-us/windows/win32/dlgbox/font-dialog-box#customizing-the-font-dialog-box-on-windows-7" and "https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms646914(v=vs.85)".

If ChooseFont API is not desirable, there is a relatively easy way (for developers, it is -- I'm not) to get the list of hidden fonts and then remove from the fonts shown to the user:

"HKCU\Software\Microsoft\Windows NT\CurrentVersion\Font Management" has a MULTI_SZ key named "Inactive Fonts" with all the fonts that was hidden by the user or by the system on behalf of the user.

There is an example for using it at https://visualstudiomagazine.com/articles/2010/10/14/honoring-hidden-fonts.aspx.  Unfortunately, it is on Visual Basic, but I hope it will help you understand.

As there are others (Comment 6) who also wants LibreOffice to hide unused international fonts, and there is a little more information I could gather, I am reopening this bug.
Comment 8 João Paulo 2020-09-29 04:16:34 UTC
I forgot to write a link to a function that could be helpful:

EnumFontFamiliesEx https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-enumfontfamiliesexa
Comment 9 V Stuart Foote 2020-09-29 12:56:45 UTC
@Mike, Tomaž -- worth another look...
Comment 10 Tomaz Vajngerl 2020-10-01 06:29:29 UTC
ChooseFont API is a NO-GO as we don't choose the fonts only with a dialog but also combo boxes in sidebar and toolbar and similar, which need to be filtered too. 

Digging into registry is a possibility. I think it needs to be implemented in vcl/win/gdi/salfont.cxx:1010 SalEnumFontsProcExW function. Check the values in the registry can be done with RegOpenKeyExW, RegQueryValueExW. (vcl/opengl/win/WinDeviceInfo.cxx:54 for example)
Comment 11 Mike Kaganski 2020-10-01 08:25:08 UTC
(In reply to Tomaz Vajngerl from comment #10)
> I think it needs to be implemented
> in vcl/win/gdi/salfont.cxx:1010 SalEnumFontsProcExW function.

But only to add a flag to the added font, since the "hiding" fonts is not meant to prevent using them, only to prevent displaying them in lists. The flag should be used later in places that display font lusts to users.
Comment 12 Tomaz Vajngerl 2020-10-01 08:35:03 UTC
Oh yeah, right.. makes sense.