summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/luaotfload-database.lua65
-rw-r--r--src/luaotfload-fontloader.lua29
2 files changed, 56 insertions, 38 deletions
diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua
index 936e380..dc783d8 100644
--- a/src/luaotfload-database.lua
+++ b/src/luaotfload-database.lua
@@ -338,7 +338,6 @@ This is a sketch of the luaotfload db:
status : filestatus;
mappings : fontentry list;
meta : metadata;
- names : namedata; // TODO: check for relevance after db is finalized
}
and familytable = {
local : (format, familyentry) hash; // specified with include dir
@@ -346,10 +345,10 @@ This is a sketch of the luaotfload db:
system : (format, familyentry) hash;
}
and familyentry = {
- regular : sizes;
- italic : sizes;
- bold : sizes;
- bolditalic : sizes;
+ r : sizes; // regular
+ i : sizes; // italic
+ b : sizes; // bold
+ bi : sizes; // bold italic
}
and sizes = {
default : int; // points into mappings or names
@@ -358,10 +357,10 @@ This is a sketch of the luaotfload db:
and metadata = {
local : bool; (* set if local fonts were added to the db *)
formats : string list; // { "otf", "ttf", "ttc", "dfont" }
- statistics : TODO;
- version : float;
+ statistics : TODO; // created when built with "--stats"
+ version : float; // index version
}
- and filemap = {
+ and filemap = { // created by generate_filedata()
base : {
local : (string, int) hash; // basename -> idx
system : (string, int) hash;
@@ -374,36 +373,36 @@ This is a sketch of the luaotfload db:
};
full : (int, string) hash; // idx -> full path
}
- and fontentry = {
- barename : string;
- familyname : string;
- filename : string;
- fontname : string; // <- metadata
- fullname : string; // <- metadata
- sanitized : {
- family : string;
- fontstyle_name : string; // <- new in 2.4
- fontname : string; // <- metadata
- fullname : string; // <- namedata.names
- metafamily : string;
- pfullname : string;
- prefmodifiers : string;
- psname : string;
- subfamily : string;
- };
- size : int list;
- slant : int;
- subfont : int;
- location : local | system | texmf;
- weight : int;
- width : int;
- units_per_em : int; // mainly 1000, but also 2048 or 256
+ and fontentry = { // finalized by collect_families()
+ basename : string; // file name without path "foo.otf"
+ conflicts : { barename : int; basename : int }; // filename conflict with font at index; happens with subfonts
+ familyname : string; // sanitized name of the font family the font belongs to, usually from the names table
+ fontname : string; // sanitized name of the font
+ fontstyle_name : string; // the fontstyle_name field returned by fontloader.info()
+ format : string; // "otf" | "ttf" | "dfont" | "pfa" | "pfb" | "afm"
+ fullname : string; // sanitized full name of the font including style modifiers
+ fullpath : string; // path to font in filesystem
+ index : int; // index in the mappings table
+ italicangle : float; // italic angle; non-zero with oblique faces
+ location : string; // "texmf" | "system" | "local"
+ metafamily : string; // alternative family identifier if appropriate, sanitized
+ plainname : string; // unsanitized font name
+ prefmodifiers : string; // sanitized preferred subfamily (names table 14)
+ psname : string; // PostScript name
+ size : (false | float * float * float); // if available, size info from the size table converted from decipoints
+ splainname : string; // sanitized version of the “plainname” field
+ splitstyle : string; // style information obtained by splitting the full name at the last dash
+ subfamily : string; // sanitized subfamily (names table 2)
+ subfont : (int | bool); // integer if font is part of a TrueType collection ("ttc")
+ version : string; // font version string
+ weight : int; // usWeightClass
}
and filestatus = (string, // fullname
{ index : int list; // pointer into mappings
timestamp : int; }) dict
-beware that this is a reconstruction and may be incomplete.
+beware that this is a reconstruction and may be incomplete or out of
+date. Last update: 2014-04-06, describing version 2.51.
mtx-fonts has in names.tma:
diff --git a/src/luaotfload-fontloader.lua b/src/luaotfload-fontloader.lua
index ca538df..d4311b2 100644
--- a/src/luaotfload-fontloader.lua
+++ b/src/luaotfload-fontloader.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 03/25/14 02:17:04
+-- merge date : 04/15/14 09:51:32
do -- begin closure to overcome local limits and interference
@@ -3394,6 +3394,17 @@ function caches.loaddata(paths,name)
for i=1,#paths do
local data=false
local luaname,lucname=makefullname(paths[i],name)
+ if lucname and not lfs.isfile(lucname) and type(caches.compile)=="function" then
+ texio.write(string.format("(compiling luc: %s)",lucname))
+ data=loadfile(luaname)
+ if data then
+ data=data()
+ end
+ if data then
+ caches.compile(data,luaname,lucname)
+ return data
+ end
+ end
if lucname and lfs.isfile(lucname) then
texio.write(string.format("(load luc: %s)",lucname))
data=loadfile(lucname)
@@ -3617,9 +3628,17 @@ local free_node=node.free
local remove_node=node.remove
local new_node=node.new
local traverse_id=node.traverse_id
-local math_code=nodecodes.math
nodes.handlers.protectglyphs=node.protect_glyphs
nodes.handlers.unprotectglyphs=node.unprotect_glyphs
+local math_code=nodecodes.math
+local end_of_math=node.end_of_math
+function node.end_of_math(n)
+ if n.id==math_code and n.subtype==1 then
+ return n
+ else
+ return end_of_math(n)
+ end
+end
function nodes.remove(head,current,free_too)
local t=current
head,current=remove_node(head,current)
@@ -3913,14 +3932,15 @@ constructors.sharefonts=false
constructors.nofsharedfonts=0
local sharednames={}
function constructors.trytosharefont(target,tfmdata)
- if constructors.sharefonts then
+ if constructors.sharefonts then
local characters=target.characters
local n=1
local t={ target.psname }
local u=sortedkeys(characters)
for i=1,#u do
+ local k=u[i]
n=n+1;t[n]=k
- n=n+1;t[n]=characters[u[i]].index or k
+ n=n+1;t[n]=characters[k].index or k
end
local h=md5.HEX(concat(t," "))
local s=sharednames[h]
@@ -5764,7 +5784,6 @@ unify=function(data,filename)
if unicode then
krn[unicode]=kern
else
- print(unicode,name)
end
end
description.kerns=krn