serialize_glyphs
Description:
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] ```
- The serialized glyphs are delimited with `[` and `]`.
- Glyphs are separated with `|`
- Each glyph starts with glyph name, or glyph index if NO_GLYPH_NAMES flag is set. Then,
- If NO_CLUSTERS is not set, `=` then cluster.
- If NO_POSITIONS is not set, the GlyphPosition in the format:
- If both x_offset and
y_offset are not 0, `
x_offset,y_offset`. Then, - `+x_advance`, then `,y_advance` if y_advance is not 0. Then,
- If GLYPH_EXTENTS is set, the GlyphExtents in the format `<x_bearing,y_bearing,width,height> `
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 |
| end |
the last item in |
| buf |
output string to write serialized buffer into. |
| buf_consumed |
if not `NULL`, will be set to the number of bytes written into |
| 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 |
| buffer |
an Buffer buffer. |
Returns:
|
The number of serialized items. |