Skip to content

Commit

Permalink
Merge branch 'dev' into latex/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
zauguin committed Jan 22, 2020
2 parents c1a8af3 + 987354e commit 80cac00
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
15 changes: 11 additions & 4 deletions doc/luaotfload-main.tex
Expand Up @@ -1944,18 +1944,25 @@
has glyph \luaident{index}.
\endaltitem

\beginaltitem {aux.slot_of_name(name : string)}
Translates an Adobe Glyph name to the corresponding glyph
slot.
\beginaltitem {aux.slot_of_name(id : int, name : string)}
Translates a name for a glyph in font \luaident{id} to the
corresponding glyph slot which can be used e.g.\ as an argument to
\inlinecode{\char}.
\endaltitem

\beginaltitem {aux.name_of_slot(slot : int)}
\beginaltitem {aux.name_of_slot(id : int, slot : int)}
The inverse of \luaident{slot_of_name}; note that this
might be incomplete as multiple glyph names may map to the
same codepoint, only one of which is returned by
\luaident{name_of_slot}.
\endaltitem

\beginaltitem {aux.gid_of_name(id : int, name : string)}
Translates a Glyph name to the corresponding GID in font
\luaident{id}. This corresponds to the value returned by
\luaident{\XeTeXglyphindex} in \XeTeX.
\endaltitem

\beginaltitem {aux.provides_script(id : int, script : string)}
Test if a font supports \luaident{script}.
\endaltitem
Expand Down
13 changes: 13 additions & 0 deletions src/luaotfload-auxiliary.lua
Expand Up @@ -429,6 +429,19 @@ function aux.name_of_slot(codepoint)
return false
end
--[[doc--
Get the GID of the glyph associated with a given name.
--doc]]--
function aux.gid_of_name(font_id, glyphname)
local slot = aux.slot_of_name(font_id, glyphname)
if not slot then return end
local tfmdata = identifiers[font_id] or font.fonts[font_id]
-- assert(tfmdata) -- Otherwise slot_of_name would have failed already
return tfmdata.characters[slot].index or slot
end
-----------------------------------------------------------------------
--- features / scripts / languages
-----------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/luaotfload-multiscript.lua
Expand Up @@ -232,7 +232,7 @@ local function makecombifont(tfmdata, _, additional_scripts)
end
for script, scr_fb in next, fallbacks do
local iso_script = script_to_iso(script)
if is_dominant_script(scr_fb, script, script_to_ot(iso_script)) then
if not additional_scripts[iso_script] and is_dominant_script(scr_fb, script, script_to_ot(iso_script)) then
local main = scr_fb[1]
table.remove(scr_fb, 1)
local fbid = luaotfload.add_fallback(scr_fb)
Expand All @@ -244,7 +244,7 @@ local function makecombifont(tfmdata, _, additional_scripts)
local collected = collect_scripts(tfmdata)
for script in next, collected do
local iso_script = script_to_iso(script)
if is_dominant_script(collected, script, script_to_ot(iso_script)) then
if not additional_scripts[iso_script] and is_dominant_script(collected, script, script_to_ot(iso_script)) then
additional_scripts[iso_script] = spec.specification .. ';-multiscript;script=' .. script
---- FIXME: IMHO the following which just modiefies the spec
-- would be nicer, but it breaks font patching callbacks
Expand Down

0 comments on commit 80cac00

Please sign in to comment.