@ -195,7 +195,7 @@ local bold_strength_factor = 3/8 -- as crengine, lighter
local _completeFaceProperties = function ( face_obj )
local _completeFaceProperties = function ( face_obj )
if not face_obj.embolden_half_strength then
if not face_obj.embolden_half_strength then
-- Cache this value in case we use bold, to avoid recomputation
-- Cache this value in case we use bold, to avoid recomputation
face_obj.embolden_half_strength = face_obj.ft fac e: getEmboldenHalfStrength ( bold_strength_factor )
face_obj.embolden_half_strength = face_obj.ft siz e: getEmboldenHalfStrength ( bold_strength_factor )
end
end
end
end
@ -302,9 +302,9 @@ function Font:getFace(font, size, faceindex)
face_obj.orig_size = orig_size
face_obj.orig_size = orig_size
end
end
else
else
-- Build face if not found
-- Build face size if not found
local builtin_font_location = FontList.fontdir .. " / " .. realname
local builtin_font_location = FontList.fontdir .. " / " .. realname
local ok , f ac e = pcall ( Freetype.newFac e, builtin_font_location , size , faceindex )
local ok , f tsiz e = pcall ( Freetype.newFac eSiz e, builtin_font_location , size , faceindex )
-- Not all fonts are bundled on all platforms because they come with the system.
-- Not all fonts are bundled on all platforms because they come with the system.
-- In that case, search through all font folders for the requested font.
-- In that case, search through all font folders for the requested font.
@ -315,14 +315,14 @@ function Font:getFace(font, size, faceindex)
for _k , _v in ipairs ( fonts ) do
for _k , _v in ipairs ( fonts ) do
if _v : find ( escaped_realname ) then
if _v : find ( escaped_realname ) then
logger.dbg ( " Found font: " , realname , " in " , _v )
logger.dbg ( " Found font: " , realname , " in " , _v )
ok , f ac e = pcall ( Freetype.newFac e, _v , size , faceindex )
ok , f tsiz e = pcall ( Freetype.newFac eSiz e, _v , size , faceindex )
if ok then break end
if ok then break end
end
end
end
end
end
end
if not ok then
if not ok then
logger.err ( " #! Font " , font , " ( " , realname , " ) not supported: " , f ac e)
logger.err ( " #! Font " , font , " ( " , realname , " ) not supported: " , f tsiz e)
return nil
return nil
end
end
--- Freetype font face wrapper object
--- Freetype font face wrapper object
@ -330,14 +330,14 @@ function Font:getFace(font, size, faceindex)
-- @field orig_font font name requested
-- @field orig_font font name requested
-- @field size size of the font face (after scaled by screen size)
-- @field size size of the font face (after scaled by screen size)
-- @field orig_size raw size of the font face (before scale)
-- @field orig_size raw size of the font face (before scale)
-- @field ft face font fac e object from freetype
-- @field ft size font siz e object from freetype
-- @field hash hash key for this font face
-- @field hash hash key for this font face
face_obj = {
face_obj = {
orig_font = font ,
orig_font = font ,
realname = realname ,
realname = realname ,
size = size ,
size = size ,
orig_size = orig_size ,
orig_size = orig_size ,
ft face = fac e,
ft size = ftsiz e,
hash = hash ,
hash = hash ,
is_real_bold = is_real_bold ,
is_real_bold = is_real_bold ,
}
}
@ -433,7 +433,7 @@ function Font:getAdjustedFace(face, bold)
-- We can keep the same FT object and the same hash in this face_obj
-- We can keep the same FT object and the same hash in this face_obj
-- (which is only used to identify cached glyphs, that we don't need
-- (which is only used to identify cached glyphs, that we don't need
-- to distinguish as "bold" is appended when synthetized as bold)
-- to distinguish as "bold" is appended when synthetized as bold)
ft face = face.ftfac e,
ft size = face.ftsiz e,
hash = face.hash ,
hash = face.hash ,
hb_features = face.hb_features ,
hb_features = face.hb_features ,
is_real_bold = nil ,
is_real_bold = nil ,