serialize_glyphs


Description:

[ Version ( since = "0.9.7" ) ]
public uint serialize_glyphs (uint start, uint end, out uint8[] buf, out uint buf_consumed, Font? font, BufferSerializeFormat format, BufferSerializeFlags flags)

Serializes buffer into a textual representation of its glyph content, useful for showing the contents of the buffer, for example during debugging.

There are currently two supported serialization formats:

text

A human-readable, plain text format. The serialized glyphs will look something like:

[uni0651=0@518,0+0|uni0628=0+1897]

json

A machine-readable, structured format. The serialized glyphs will look something like:

[{"g":"uni0651","cl":0,"dx":518,"dy":0,"ax":0,"ay":0},
{"g":"uni0628","cl":0,"dx":0,"dy":0,"ax":1897,"ay":0}]

Each glyph is a JSON object, with the following properties: - `g`: the glyph name or glyph index if NO_GLYPH_NAMES flag is set. - `cl`: cluster if NO_CLUSTERS is not set. - `dx`,`dy`,`ax`,`ay`: x_offset, y_offset, x_advance and y_advance respectively, if NO_POSITIONS is not set. - `xb`,`yb`,`w`,`h`: x_bearing, y_bearing, width and height respectively if GLYPH_EXTENTS is set.

Parameters:

start

the first item in buffer to serialize.

end

the last item in buffer to serialize.

buf

output string to write serialized buffer into.

buf_consumed

if not `NULL`, will be set to the number of bytes written into buf.

font

the Font used to shape this buffer, needed to read glyph names and extents. If `NULL`, an empty font will be used.

format

the BufferSerializeFormat to use for formatting the output.

flags

the BufferSerializeFlags that control what glyph properties to serialize.

buf_size

the size of buf.

buffer

an Buffer buffer.

Returns:

The number of serialized items.