Hi Tassilo,

2013/12/23 Tassilo Horn <[email protected]>:
> Ah, a bit of googling revealed there's an -vvv option to make it very
> verbose.  With
>
>   % luaotfload-tool --update --force -vvv
>
> I get tons of output like
>
> luaotfload | db: loading font “/usr/share/fonts/lyx/rsfs10.ttf”
> luaotfload | db: loading font “/usr/share/fonts/lyx/msbm10.ttf”
> luaotfload | db: loading font “/usr/share/fonts/lyx/msam10.ttf”
> luaotfload | db: loading font “/usr/share/fonts/lyx/wasy10.ttf”
> luaotfload | db: loading font “/usr/share/fonts/lyx/cmmi10.ttf”
> luaotfload | db: loading font “/usr/share/fonts/lyx/cmex10.ttf”
> luaotfload | db: loading font “/usr/share/fonts/lyx/cmsy10.ttf”
> luaotfload | db: 0 'TTF' fonts found
> luaotfload | db: 0 'ttc' fonts found
> luaotfload | db: 0 'TTC' fonts found
> luaotfload | db: 0 'dfont' fonts found
> luaotfload | db: 0 'DFONT' fonts found
> luaotfload | db: 75 fonts found in '/usr/share/fonts'
> [...]
> luaotfload | db: Scanned 3381 font files; 626 new entries.
> luaotfload | db: Rebuilt in 32789 ms
> luaotfload | db: Fonts in the database: 626
> luaotfload | db: Font names database saved
> luaotfload | util: task completed successfully
>
> which looks good, I think, but still...
>
>   % luaotfload-tool --list=basename
>
>   luaotfload | list: by basename
>
> There are 2 filled database files, though.
>
>   
> /home/horn/.texlive/texmf-var/luatex-cache/generic/names/luaotfload-names.lua
>   
> /home/horn/.texlive/texmf-var/luatex-cache/generic/names/luaotfload-names.luc

I don't know what is wrong with your version :-\  This is the
beginning of my `luaotfload-tool' output:
--8<---------------cut here---------------start------------->8---
% luaotfload-tool --list=basename

AccanthisADFStdNo3-Bold.otf     Accanthis ADF Std No3 Bold      1.008
AccanthisADFStdNo3-BoldItalic.otf       Accanthis ADF Std No3 Bold
Italic       1.008
AccanthisADFStdNo3-Italic.otf   Accanthis ADF Std No3 Italic    1.008
AccanthisADFStdNo3-Regular.otf  Accanthis ADF Std No3 Regular   1.00
--8<---------------cut here---------------end--------------->8---

I'm sending a patch which replicates the behavior of
`TeX-arg-input-file-search': this adds an option to decide whether the
font should be searched or not, and a default list of fonts to be used
for completion when `luaotfload-tool --list=basename' doesn't work.

I want to make it clear the `luaotfload' bundle is necessary in order
to use `fontspec' with LuaLaTeX (but not with XeLaTeX), indeed
`fontspec' loads the `luaotfload' package.  So requiring
`luaotfload-tool' to make `LaTeX-fontspec-arg-font' completion work is
not a stringent requirement, it only needs a somewhat recent version
(I think version 2.3 or higher).

Bye,
Mosè
diff --git a/style/fontspec.el b/style/fontspec.el
index 1d73a40..f9137fb 100644
--- a/style/fontspec.el
+++ b/style/fontspec.el
@@ -138,23 +138,29 @@
   "Prompt for a font name with completion.
 If OPTIONAL is non-nil, insert the resulting value as an optional
 argument, otherwise as a mandatory one.  Use PROMPT as the prompt
-string."
+string.
+
+Customize `LaTeX-fontspec-arg-font-search' in order to decide how
+to retrieve the list of fonts."
   (unless LaTeX-fontspec-font-list
-    (with-temp-buffer
-      ;; Insert into the temporary buffer the list of fonts retrieved with
-      ;; `luaotfload-tool'.  The list is in the form
-      ;;     <base name><TAB><family name><TAB><version>
-      (shell-command "luaotfload-tool --list=basename" t)
-      ;; Search for the fonts base names and family names, and add them to
-      ;; `LaTeX-fontspec-font-list'.
-      (while
-	  (re-search-forward "^\\([^\n\r\t]*\\)\t\\([^\n\r\t]*\\)\t.*$" nil t)
-	(add-to-list 'LaTeX-fontspec-font-list (match-string-no-properties 1))
-	(add-to-list 'LaTeX-fontspec-font-list (match-string-no-properties 2)))))
+    (when (if (eq LaTeX-fontspec-arg-font-search 'ask)
+	      (not (y-or-n-p "Find font yourself? "))
+	    LaTeX-fontspec-arg-font-search)
+      (message "Searching for fonts...")
+      (with-temp-buffer
+	(shell-command "luaotfload-tool --list=basename" t)
+	;; Search for the font base names and full names, and add them to
+	;; `LaTeX-fontspec-font-list'.  The list is in the form
+	;;     <base name><TAB><full name><TAB><version>
+	(while
+	    (re-search-forward "^\\([^\n\r\t]*\\)\t\\([^\n\r\t]*\\)\t.*$" nil t)
+	  (add-to-list 'LaTeX-fontspec-font-list (match-string-no-properties 1))
+	  (add-to-list 'LaTeX-fontspec-font-list
+		       (match-string-no-properties 2))))))
   (TeX-argument-insert
    (completing-read
     (TeX-argument-prompt optional prompt "Font name")
-    LaTeX-fontspec-font-list)
+    (or LaTeX-fontspec-font-list LaTeX-fontspec-font-list-default))
    optional))
 
 (TeX-add-style-hook
diff --git a/tex-style.el b/tex-style.el
index 05a706e..41034d1 100644
--- a/tex-style.el
+++ b/tex-style.el
@@ -254,6 +254,28 @@ produced by emp.sty and then re-LaTeX the document."
   :type 'boolean
   :group 'LaTeX-style)
 
+;; style/fontspec.el
+
+(defcustom LaTeX-fontspec-arg-font-search t
+  "If `LaTeX-fontspec-arg-font' should search for fonts.
+If the value is t, fonts are retrieved and provided for
+completion.  If the value is nil,
+`LaTeX-fontspec-font-list-default' is used for completion.  If
+the value is `ask', you are asked for the method to use every
+time `LaTeX-fontspec-arg-font' is called.
+
+`LaTeX-fontspec-arg-font' calls `luaotf-load --list=basename' to
+automatically get the list of fonts.  This requires
+`luaotfload-tool' version 2.3 or higher in order to work."
+  :group 'LaTeX-style
+  :type '(choice (const t) (const nil) (const ask)))
+
+(defcustom LaTeX-fontspec-font-list-default nil
+  "List of default fonts to be used as completion for
+`LaTeX-fontspec-arg-font'."
+  :group 'LaTeX-style
+  :type '(repeat :tag "Font" (string)))
+
 ;; style/graphicx.el
 
 (defcustom LaTeX-includegraphics-extensions
_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to