-
Notifications
You must be signed in to change notification settings - Fork 8
find fonts in Windows registry #270
Comments
I’m a bit at loss here: What’s a “shortcut” in this context? I don’t currently have a Win VM for testing so I can’t really |
In this context, shortcuts are something really Windows-specific, it's a file (with extension |
Hi! Thanks for helping out, Elie. Windows shortcuts are like pointers - they are not symlinks. For an example, I can create a shortcut to a folder on my computer's desktop. When I click on the shortcut, Explorer follows the shortcut and opens the folder. The shortcut's file is a *.lnk file (L not i) and if you view it's properties in Windows Explorer you can see that it has a "target file". You can install a font in Windows by creating a shortcut to the font file and placing that shortcut in c:\windows\fonts. |
@BGMcoder remember you're talking to people who haven't been using Windows for years... |
Parsing a .lnk file in lua might be a nightmare... Maybe the best would be to propose a patch for LuaTeX adding a lua function calling the relevant Windows system calls? Maybe Hans would be ok to add this, as I guess ConTeXt would need to read lnk in C:\Windows\Fonts too? |
@eroux Well, I've tried to explain it. Windows has used .lnk files for as long as I can remember. Also in Windows, if you right click on or alt+drag any file you can "Create Shortcut". |
In Windows, when you (or your font management application) create a shortcut to a font file and put it in C:\Windows\fonts, Windows treats that font as being "installed" and the font is available to be used now by any application. I suspect that lualatex is not using Windows' own font index, but is reading from the font directory directly. |
pretty much yes... Do you have information about the "Windows' own font index"? |
@eroux Well, okay, Windows stores a list of all the fonts in the registry: Windows NT I just looked at this on my computer and confirm that it is the case. So, perhaps lualatex would do better to scan that registry key rather than the fonts folder. Also, here is a thread that explains a bit about the shortcuts: https://thecustomizewindows.com/2011/01/install-fonts-using-shortcut-in-windows-7/ |
You can see some screenshots of the registry open to the fonts: Instead of scanning the registry over and over, you could export the key (pretty easy in code!) and then read through the exported text file. But you'd have to refresh it obviously. |
Apparently there's a lua module to read the registry... I think if it's added to ctan it could land into TeXLive (as it's Windows-specific, it could be distributed compiled), and it could be used... |
Some basic info: http://en.wikipedia.org/wiki/.lnk Sounds horrible, especially in the light of all the directory traversal It gets worse:
Especially the “cannot be used in place of the file except in Windows Explorer” Are these things really a common way of handling font files? Even Context
Correct, that’s kind of the point. You supply a path ( In any case, before anything can be done we’ll need some official |
Btw. what does Xetex do if you ask it to read a |
I agree this is really a terrible design answer, certainly initially thought as a dirty replacement for the lack of link functionality in FAT32, and kept ever since, since MS has a policy of keeping the creepy things it invented in the XXth century forever... This kind of reasons made me flee Windows some time ago... I think this link contains some kind of specifications (if you're not affraid in navigating terrible MS doc). I thought about a solution not involving luaotfload: do we still use fontconfig? If so, it might help... otherwise, if you're not willing to implement it (which I understand), maybe @BGMcoder could propose a patch, and in the mean time, you could just document that it doesn't work. What do you think? |
@eroux Sure, I am willing to help - I've never made a patch before. What do I do? What do I test? |
First it would help to see if XeTeX recognizes the font, can you please try? Afterwards you'll have to fork the repository, clone it on your machine, install the version of luaotfload you've just cloned, understand the code that needs fixing (certainly in src/luaotfload-database.lua), find a proper way to read a .lnk file in lua, fix the code, and make a pull request... |
Oh, wow; that sounds rather more involved than I am allowed to commit to... I don't think I can do this. |
Ok, can you at least try with XeTeX please? Take any document (not involving gregorio) using you linked font, to see if XeTeX manages to read the font |
I can do that. I have xetex on the commandline. What kind of document? \documentclass{article} |
You can use |
okay, so I have a font installed via shortcut called "ActionIs Regular". !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! l.3 \setmainfont{actionis regular} ? !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! l.3 \setmainfont{actionis regular} ? ? |
Thanks! @phi-gamma, if you agree, we can mark it as wontfix (until someone provides a patch) and document it? |
I was about to make a pull request to add the documentation, should I base it on master or is there a more recent branch on your repo? |
@eroux I posted a thread in the High-Logic Font Manager forum, and the windows font guru, Mr. Dennissen is answering my thread. So, it appears I have misled you - Windows Explorer shows those shortcuts, but they are not really there. Apparently, it is a Windows trick to show the shortcut icons. Those files are not located in c:\windows\fonts - AND NEITHER ARE THE *.lnk files. Windows Explorer just shows all the installed fonts there even though there are no files there for those fonts. It's confusing because Explorer is lying to us. When I open c:\windows\fonts in my other file-browser then it shows me the real contents of that directory - AND those fonts are not there, and neither are there any *.lnk files. |
So there are no *.lnk files to read at all. You'll have to read the registry. |
Wow, this design is incredibe... So it seems there are people who sell fonts with an installer that doesn't put the fonts in |
@eroux read this response: http://forum.high-logic.com/viewtopic.php?f=12&t=5612&p=25551#p25552 |
There's an entry about reading the register in the Lua FAQ |
Here's something relevant! |
@phi-gamma what do you think about asking Hans about what would be the best solution to that (if any)? There's a ConTeXt user on the thread and this link that might be helpful. Maybe he'd like to have it working in ConTeXt... What do you think? If you agree, tell me if you prefer asking him directly or if you want me to do it. |
I think the best solution would be Hans' proposal. The main problem is that, as |
@eroux I did a dump of the registry fonts à la Hans on some test |
Great! Thanks a lot! |
···<date: 2015-05-30, Saturday>···<from: Elie Roux>···
Here’s a POC parser for
There’s a problem though: The fonts listed are all located in the Using standard GUI methods (install via context menu) I can’t
on a system with shortcut-installed fonts and supply us with the |
Closing this due to lack of feedback. |
Apparently, Windows 7 allows shortcuts in
C://Windows/Fonts
, see this doc. And apparently, luaotfload doesn't recognize them.The text was updated successfully, but these errors were encountered: