< Previous | Contents | Next >
Process

function Process(req)
local img = InImage:GetValue(req) local font = InFont:GetValue(req).Value
local style = InFontStyle:GetValue(req).Value
local out = img:CopyOf()
local text local size
local center
= InText:GetValue(req).Value
= InSize:GetValue(req).Value
= InPosition:GetValue(req)
local justify= InJustify:GetValue(req).Value local r = InR:GetValue(req).Value
local g = InG:GetValue(req).Value
local b = InB:GetValue(req).Value
local a = InA:GetValue(req).Value
local cx = center.X
local cy = center.Y * (out.Height * out.YScale) / (out.Width * out.XScale) local quality = 32
-- if the FontManager list is empty, scan the font list
-- If the UI has never been shown, as would always be the case on a render node,
-- nothing will scan the font list for available fonts. So we check for that here,
-- and force a scan if needed.
if not next( FontManager:GetFontList() ) then FontManager:ScanDir()
end
if req:IsQuick() then
quality = 1
end
-- the drawstring function is doing all the heavy lifting
drawstring(out, font, style, size, justify, quality, cx, cy, Pixel{R=r,G=g,B=b,A=a}, text)
OutImage:Set(req, out)
end
The Process.Function in this Fuse will get 11 variables from the UI, Text strings, fonts and metrics, color and on screen location. If no font list is populated it will force the scanning of the Font list from the OS.