// GENERATED — DO NOT EDIT

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.GlyphItem.html).
pub type GlyphItem

///|
pub(open) trait IGlyphItem {
  fn as_glyph_item(Self) -> GlyphItem
  fn apply_attrs(Self, String, AttrList) -> Array[GlyphItem] = _
  fn get_logical_widths(Self, String) -> Array[Int] = _
  fn letter_space(Self, String, FixedArray[LogAttr], Int) -> Unit = _
  fn split(Self, String, Int) -> GlyphItem? = _
}

///|
pub impl IGlyphItem for GlyphItem with fn as_glyph_item(self) {
  self
}

///|
#borrow(self_, text, list, result)
extern "c" fn moonbit_pango_glyph_item_apply_attrs(
  self_ : GlyphItem,
  text : Bytes,
  list : AttrList,
  result : Ref[FixedArray[GlyphItem]],
) = "moonbit_pango_glyph_item_apply_attrs"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.GlyphItem.apply_attrs.html).
pub fn GlyphItem::apply_attrs(
  self : GlyphItem,
  text : String,
  list : AttrList,
) -> Array[GlyphItem] {
  let result_ref : Ref[FixedArray[GlyphItem]] = Ref([])
  moonbit_pango_glyph_item_apply_attrs(
    self,
    @encoding/utf8.encode(text),
    list,
    result_ref,
  )
  let values : Array[GlyphItem] = Array::new(capacity=result_ref.val.length())
  for value in result_ref.val {
    values.push(value)
  }
  values
}

///|
#borrow(self_, text, logical_widths)
extern "c" fn moonbit_pango_glyph_item_get_logical_widths(
  self_ : GlyphItem,
  text : Bytes,
  logical_widths : Ref[FixedArray[Int]],
) = "moonbit_pango_glyph_item_get_logical_widths"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.GlyphItem.get_logical_widths.html).
pub fn GlyphItem::get_logical_widths(
  self : GlyphItem,
  text : String,
) -> Array[Int] {
  let logical_widths : Ref[FixedArray[Int]] = Ref([])
  moonbit_pango_glyph_item_get_logical_widths(
    self,
    @encoding/utf8.encode(text),
    logical_widths,
  )
  let result : Array[Int] = Array::new(capacity=logical_widths.val.length())
  for i in 0.. Unit {
  let log_attrs_ref : Ref[FixedArray[LogAttr]] = Ref(log_attrs)
  moonbit_pango_glyph_item_letter_space(
    self,
    @encoding/utf8.encode(text),
    log_attrs_ref,
    letter_spacing,
  )
}

///|
#borrow(self_, text)
extern "c" fn moonbit_pango_glyph_item_split(
  self_ : GlyphItem,
  text : Bytes,
  split_index : Int,
) -> @glib.Nullable[GlyphItem] = "moonbit_pango_glyph_item_split"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.GlyphItem.split.html).
pub fn GlyphItem::split(
  self : GlyphItem,
  text : String,
  split_index : Int,
) -> GlyphItem? {
  let raw_result = moonbit_pango_glyph_item_split(
    self,
    @encoding/utf8.encode(text),
    split_index,
  )
  raw_result.to_option()
}

///|
impl IGlyphItem with fn apply_attrs(self, text, list) -> Array[GlyphItem] {
  self.as_glyph_item().apply_attrs(text, list)
}

///|
impl IGlyphItem with fn get_logical_widths(self, text) -> Array[Int] {
  self.as_glyph_item().get_logical_widths(text)
}

///|
impl IGlyphItem with fn letter_space(self, text, log_attrs, letter_spacing) -> Unit {
  self.as_glyph_item().letter_space(text, log_attrs, letter_spacing)
}

///|
impl IGlyphItem with fn split(self, text, split_index) -> GlyphItem? {
  self.as_glyph_item().split(text, split_index)
}

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.GlyphItem.html).
#borrow(self_)
pub extern "c" fn GlyphItem::get_item(self_ : GlyphItem) -> Item = "moonbit_pango_glyph_item_item_get"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.GlyphItem.html).
#borrow(self_)
pub extern "c" fn GlyphItem::get_glyphs(self_ : GlyphItem) -> GlyphString = "moonbit_pango_glyph_item_glyphs_get"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.GlyphItem.html).
#borrow(self_)
pub extern "c" fn GlyphItem::get_y_offset(self_ : GlyphItem) -> Int = "moonbit_pango_glyph_item_y_offset_get"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.GlyphItem.html).
#borrow(self_)
pub extern "c" fn GlyphItem::set_y_offset(self_ : GlyphItem, value : Int) = "moonbit_pango_glyph_item_y_offset_set"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.GlyphItem.html).
#borrow(self_)
pub extern "c" fn GlyphItem::get_start_x_offset(self_ : GlyphItem) -> Int = "moonbit_pango_glyph_item_start_x_offset_get"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.GlyphItem.html).
#borrow(self_)
pub extern "c" fn GlyphItem::set_start_x_offset(self_ : GlyphItem, value : Int) = "moonbit_pango_glyph_item_start_x_offset_set"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.GlyphItem.html).
#borrow(self_)
pub extern "c" fn GlyphItem::get_end_x_offset(self_ : GlyphItem) -> Int = "moonbit_pango_glyph_item_end_x_offset_get"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.GlyphItem.html).
#borrow(self_)
pub extern "c" fn GlyphItem::set_end_x_offset(self_ : GlyphItem, value : Int) = "moonbit_pango_glyph_item_end_x_offset_set"