util
Functionsโ
fromPixels()โ
util.fromPixels(value: number, units?: types.VisioUnitType | string): number;
Convert a given value
from pixels to the provided units
. units
should be a valid numeric type supported by
Visio (types.VisioUnitType). Supported numeric unit types: IN
, IN_F
, DL
,
DP
, DT
, PT
, MM
, CM
.
const inches = vsdUtil.fromPixels(96, VisioUnitType.IN); // 1
isFontAvailable()โ
util.isFontAvailable(fonts: string): boolean;
util.isFontAvailable(fonts: string[]): boolean[];
Return true
if provided font is available for the application.
The function accepts either a string
name of a single font, or an array
of font names. If a string was provided,
the function will return true
if the font is available in the browser. Otherwise, it will return false
. If an array
of font names was provided, an array
of true/false
results will be returned in order of the provided collection of
font names.
toPixels()โ
util.toPixels(value: number, units?: types.VisioUnitType | string): number;
Convert the given numeric value
to pixels. Function takes opt
object in which a units
property can be defined.
If no units
is provided, types.VisioUnitType.IN
is used by default. Supported numeric unit types: IN
, IN_F
,
DL
, DP
, DT
, PT
, MM
, CM
const px = vsdUtil.toPixels(1, VisioUnitType.IN); // 96