magickQueryFontMetrics method

Float64List? magickQueryFontMetrics(
  1. DrawingWand drawingWand,
  2. String text
)

Returns a 13 element array representing the following font metrics:

Element Description
-------------------------------------------------
0 character width
1 character height
2 ascender
3 descender
4 text width
5 text height
6 maximum horizontal advance
7 bounding box: x1
8 bounding box: y1
9 bounding box: x2
10 bounding box: y2
11 origin: x
12 origin: y
  • Note: null is returned if the font metrics cannot be determined from the given input (for ex: if the MagickWand contains no images).

Implementation

Float64List? magickQueryFontMetrics(DrawingWand drawingWand, String text) =>
    using((Arena arena) {
      final Pointer<Char> textPtr =
          text.toNativeUtf8(allocator: arena).cast();
      final Pointer<Double> metricsPtr =
          _magickWandBindings.MagickQueryFontMetrics(
        _wandPtr,
        drawingWand._wandPtr,
        textPtr,
      );
      final Float64List? metrics = metricsPtr.toFloat64List(13);
      _magickRelinquishMemory(metricsPtr.cast());
      return metrics;
    });