// SPDX-License-Identifier: MIT OR MPL-2.0 OR LGPL-2.1-or-later OR GPL-2.0-or-later
// Copyright (C) 2012 SIL International
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace NGraphite
{
public class Graphite2Api
{
public Graphite2Api()
{
}
#region Font methods
///
/// Returns version information on this engine
///
[DllImport("graphite2.dll", EntryPoint="gr_engine_version")]
internal static extern void EngineVersion(out int nMajor, out int nMinor, out int nBugFix);
///
/// type describing function to retrieve font table information
///
internal delegate /*gr_face*/ IntPtr GetTableFn(IntPtr appFaceHandle, uint name, out int len);
///
/// Create a gr_face object given application information and a getTable function
///
///
/// gr_face or NULL if the font fails to load for some reason.
///
///
/// This is application specific information that is passed to the getTable
/// function. The appFaceHandle must stay alive as long as the gr_face is alive.
///
///
/// This function is called whenever graphite needs access to a table of data
/// in the font.
///
///
/// Bitfield describing various options. See enum gr_face_options for details.
///
[DllImport("graphite2.dll", EntryPoint="gr_make_face")]
internal static extern /*gr_face*/ IntPtr MakeFace(IntPtr appFaceHandle, GetTableFn getTable, uint faceOptions);
// This only exists if GRAPHITE2_NSEGCACHE was not defined when graphite was compiled.
///
/// Create a gr_face object given application information, with subsegmental caching support
///
///
/// gr_face or NULL if the font fails to load.
///
///
/// is a pointer to application specific information that is passed to getTable.
/// This may not be NULL and must stay alive as long as the gr_face is alive.
///
///
/// The function graphite calls to access font table data
///
///
/// How large the segment cache is.
///
///
/// Bitfield of values from enum gr_face_options
///
[DllImport("graphite2.dll", EntryPoint="gr_make_face_with_seg_cache")]
internal static extern /*gr_face*/ IntPtr MakeFaceWithSegCache(IntPtr appFaceHandle, GetTableFn getTable, uint segCacheMaxSize, uint faceOptions);
///
/// Convert a tag in a string into a gr_uint32
///
///
/// gr_uint32 tag, zero padded
///
///
/// str a nul terminated string of which at most the first 4 characters are read
///
[DllImport("graphite2.dll", EntryPoint="gr_str_to_tag")]
internal static extern UInt32 StrToTag(string str);
///
/// Convert a gr_uint32 tag into a string
///
///
/// contains the tag to convert
///
///
/// is a pointer to a char array of at least size 4 bytes. The first 4 bytes of this array
/// will be overwritten by this function. No nul is appended.
///
[DllImport("graphite2.dll", EntryPoint="gr_tag_to_str")]
internal static extern void TagToStr(UInt32 tag, IntPtr str);
///
/// Get feature values for a given language or default
///
///
/// a copy of the default feature values for a given language. The application must call
/// gr_featureval_destroy() to free this object when done.
///
///
/// The font face to get feature values from
///
///
/// The language tag to get feature values for. If there is no such language or
/// langname is 0, the default feature values for the font are returned.
/// langname is right 0 padded and assumes lowercase. Thus the en langauge
/// would be 0x656E0000. Langname may also be space padded, thus 0x656E2020.
///
[DllImport("graphite2.dll", EntryPoint="gr_face_featureval_for_lang")]
internal static extern /*gr_feature_val */ IntPtr FaceFeaturevalForLang(/* gr_face */ IntPtr pFace, UInt32 langname);
///
/// Get feature reference for a given feature id from a face
///
///
/// a feature reference corresponding to the given id. This data is part of the gr_face and
/// will be freed when the face is destroyed.
///
///
/// Font face to get information on.
///
///
/// Feature id tag to get reference to.
///
[DllImport("graphite2.dll", EntryPoint="gr_face_find_fref")]
internal static extern /* gr_feature_ref*/ IntPtr FaceFindFref(/* gr_face */ IntPtr pFace, Int32 featid);
///
/// Returns number of feature references in a face
///
[DllImport("graphite2.dll", EntryPoint="gr_face_n_fref")]
internal static extern UInt16 FaceNFref(/* gr_face */ IntPtr pFace);
///
/// Returns feature reference at given index in face
///
[DllImport("graphite2.dll", EntryPoint="gr_face_fref")]
internal static extern /* gr_feature_ref */ IntPtr FaceFref(/*gr_face*/ IntPtr pFace, UInt16 i);
///
/// Return number of languages the face knows about
///
[DllImport("graphite2.dll", EntryPoint="gr_face_n_languages")]
internal static extern ushort FaceNLanguages(/*gr_face*/ IntPtr pFace);
///
/// Returns a language id corresponding to a language of given index in the face
///
[DllImport("graphite2.dll", EntryPoint="gr_face_lang_by_index")]
internal static extern UInt32 FaceLangByIndex(/*gr_face*/ IntPtr pFace, UInt16 i);
///
/// Destroy the given face and free its memory
///
[DllImport("graphite2.dll", EntryPoint="gr_face_destroy")]
internal static extern void FaceDestroy(/*gr_face*/ IntPtr pFace);
///
/// Returns the number of glyphs in the face
///
[DllImport("graphite2.dll", EntryPoint="gr_face_n_glyphs")]
internal static extern short FaceNGlyphs(/*gr_face*/ IntPtr pFace);
// Only exists if GRAPHITE2_NFILEFACE was not defined when libgraphite2 was compiled
///
/// Create gr_face from a font file
///
///
/// gr_face that accesses a font file directly. Returns NULL on failure.
///
///
/// Full path and filename to font file
///
///
/// Bitfile from enum gr_face_options to control face options.
///
[DllImport("graphite2.dll", EntryPoint="gr_make_file_face")]
internal static extern /*gr_face*/ IntPtr MakeFileFace(string filename, FaceOptions faceOptions);
// Only exists if GRAPHITE2_NFILEFACE was not defined when libgraphite2 was compiled
///
/// Create gr_face from a font file, with subsegment caching support.
///
///
/// gr_face that accesses a font file directly. Returns NULL on failure.
///
///
/// Full path and filename to font file
///
///
/// Specifies how big to make the cache in segments.
///
///
/// Bitfield from enum gr_face_options to control face options.
///
[DllImport("graphite2.dll", EntryPoint="gr_make_file_face_with_seg_cache")]
internal static extern /*gr_face*/ IntPtr MakeFileFaceWithSegCache(string filename, uint segCacheMaxSize, FaceOptions faceOptions);
///
/// Create a font from a face
///
///
/// gr_font Call font_destroy to free this font
///
///
/// Resolution of the font in pixels per em
///
///
/// Face this font corresponds to. This must stay alive as long as the font is alive.
///
[DllImport("graphite2.dll", EntryPoint="gr_make_font")]
internal static extern /*gr_font*/ IntPtr MakeFont(float ppm, /*gr_face*/ IntPtr face);
///
/// query function to find the hinted advance width of a glyph
///
internal delegate float AdvanceFn(IntPtr appFontHandle, UInt16 glyphid);
///
/// Creates a font with hinted advance width query function
///
///
/// gr_font to be destroyed via font_destroy
///
///
/// size of font in pixels per em
///
///
/// font specific information that must stay alive as long as the font does
///
///
/// function to call with appFontHandle and glyphid to get horizontal advance in pixels.
///
///
/// the face this font corresponds to. Must stay alive as long as the font does.
///
[DllImport("graphite2.dll", EntryPoint="gr_make_font_with_advance_fn")]
internal static extern /*gr_font*/ IntPtr MakeFontWithAdvanceFn(float ppm, IntPtr appFontHandle, AdvanceFn advance, /*gr_face*/IntPtr face);
///
/// Free a font
///
[DllImport("graphite2.dll", EntryPoint="gr_font_destroy")]
internal static extern void FontDestroy(/*gr_font*/ IntPtr font);
///
/// get a feature value
///
///
/// value of specific feature or 0 if any problems.
///
///
/// gr_feature_ref to the feature
///
///
/// containing all the values
///
[DllImport("graphite2.dll", EntryPoint="gr_fref_feature_value")]
internal static extern UInt16 FrefFeatureValue(/*gr_feature_ref*/ IntPtr pfeatureref, /*gr_feature_val*/IntPtr feats);
///
/// set a feature value
///
///
/// false if there were any problems (value out of range, etc.)
///
///
/// gr_feature_ref to the feature
///
///
/// value to set the feature to
///
///
/// the gr_feature_val containing all the values for all the features
///
[DllImport("graphite2.dll", EntryPoint="gr_fref_set_feature_value")]
internal static extern int FrefSetFeatureValue(/*gr_feature_ref*/ IntPtr pfeatureref, UInt16 val, /*gr_feature_val*/IntPtr pDest);
///
/// Returns the id tag for a gr_feature_ref
///
[DllImport("graphite2.dll", EntryPoint="gr_fref_id")]
internal static extern UInt32 FrefId(/*gr_feature_ref*/ IntPtr pfeatureref);
///
/// Returns number of values a feature may take, given a gr_feature_ref.
///
[DllImport("graphite2.dll", EntryPoint="gr_fref_n_values")]
internal static extern UInt16 FrefNValues(/*gr_feature_ref*/ IntPtr pfeatureref);
///
/// Returns the value associated with a particular value in a feature
///
///
/// value.
///
///
/// gr_feature_ref of the feature of interest
///
///
/// Index up to the return value of gr_fref_n_values() of the value
///
[DllImport("graphite2.dll", EntryPoint="gr_fref_value")]
internal static extern UInt16 FrefValue(/*gr_feature_ref*/ IntPtr pfeatureref, UInt16 settingno);
///
/// Returns a string of the UI name of a feature
///
///
/// string of the UI name, in the encoding form requested. Call gr_label_destroy() after use.
///
///
/// gr_feature_ref of the feature
///
///
/// This is a pointer since the face may not support a string in the requested
/// language. The actual language of the string is returned in langId
///
///
/// Encoding form for the string
///
///
/// Used to return the length of the string returned in bytes.
///
[DllImport("graphite2.dll", EntryPoint="gr_fref_label", CharSet = CharSet.Ansi)]
internal static extern IntPtr FrefLabel(/*gr_feature_ref*/ IntPtr pfeatureref, ref UInt16 langid, Encform utf, out UInt32 length);
///
/// Return a UI string for a possible value of a feature
///
///
/// string of the UI name, in the encoding form requested. nul terminated. Call gr_label_destroy()
/// after use.
///
///
/// gr_feature_ref of the feature
///
///
/// Value setting index
///
///
/// This is a pointer to the requested language. The requested language id is
/// replaced by the actual language id of the string returned.
///
///
/// Encoding form for the string
///
///
/// Returns the length of the string returned in bytes.
///
[DllImport("graphite2.dll", EntryPoint="gr_fref_value_label")]
internal static extern IntPtr FrefValueLabel(/*gr_feature_ref*/ IntPtr pfeatureref, UInt16 settingsno, ref UInt16 langId, Encform utf, out UInt32 length);
///
/// Destroy a previously returned label string
///
[DllImport("graphite2.dll", EntryPoint="gr_label_destroy")]
internal static extern void LabelDestroy(IntPtr label);
///
/// Copies a gr_feature_val
///
[DllImport("graphite2.dll", EntryPoint="gr_featureval_clone")]
internal static extern /*gr_feature_val*/ IntPtr FeaturevalClone(/*gr_feature_val*/ IntPtr pfeatures);
///
/// Destroys a gr_feature_val
///
[DllImport("graphite2.dll", EntryPoint="gr_featureval_destroy")]
internal static extern void FeatureValDestroy(/*gr_feature_val*/ IntPtr pfeatures);
#endregion
#region Segment methods
///
/// Returns Unicode character for a charinfo.
///
///
/// Pointer to charinfo to return information on.
///
[DllImport("graphite2.dll", EntryPoint="gr_cinfo_unicode_char")]
internal static extern UInt32 CinfoUnicodeChar(/*gr_char_info**/ IntPtr p/*not NULL*/);
///
/// Returns breakweight for a charinfo.
///
///
/// Breakweight is a number between -50 and 50 indicating the cost of a
/// break before or after this character.
///
///
/// Pointer to charinfo to return information on.
///
[DllImport("graphite2.dll", EntryPoint="gr_cinfo_break_weight")]
internal static extern int CinfoBreakWeight(/*gr_char_info**/ IntPtr p/*not NULL*/);
///
/// Returns the slot index that after this character is after in the slot stream
///
///
/// after slot index between 0 and gr_seg_n_slots()
///
///
/// Pointer to charinfo to return information on.
///
[DllImport("graphite2.dll", EntryPoint="gr_cinfo_after")]
internal static extern int CinfoAfter(/*gr_char_info**/IntPtr p/*not NULL*/);
///
/// Returns the slot index that before this character is before in the slot stream
///
///
/// before slot index between 0 and gr_seg_n_slots()
///
///
/// Pointer to charinfo to return information on.
///
[DllImport("graphite2.dll", EntryPoint="gr_cinfo_before")]
internal static extern int CinfoBefore(/*gr_char_info**/IntPtr p/*not NULL*/);
///
/// Returns the code unit index of this character in the input string
///
///
/// code unit index between 0 and the end of the string
///
///
/// Pointer to charinfo to return information on.
///
[DllImport("graphite2.dll", EntryPoint="gr_cinfo_base")]
internal static extern int CinfoBase(/*gr_char_info**/IntPtr p/*not NULL*/);
///
/// Returns the number of unicode characters in a string.
///
///
/// number of characters in the string
///
///
/// the type of data in the string: utf8, utf16, utf32
///
///
/// The start of the string
///
///
/// Measure up to the first nul or when end is reached, whichever is earliest.
/// This parameter may be NULL.
///
///
/// If there is a structural fault in the string, the location is returned
/// in this variable. If no error occurs, pError will contain NULL. NULL
/// may be passed for pError if no such information is required.
///
[DllImport("graphite2.dll", EntryPoint="gr_count_unicode_characters")]
internal static extern int CountUnicodeCharacters(Encform enc, IntPtr buffer_begin, IntPtr buffer_end, ref IntPtr pError);
///
/// Creates and returns a segment.
///
///
/// a segment that needs seg_destroy called on it. May return NULL if bad problems
/// in segment processing.
///
///
/// Gives the size of the font in pixels per em for final positioning. If
/// NULL, positions are returned in design units, i.e. at a ppm of the upem
/// of the face.
///
///
/// The face containing all the non-size dependent information.
///
///
/// This is a tag containing a script identifier that is used to choose
/// which graphite table within the font to use. Maybe 0. Tag may be 4 chars
/// NULL padded in LSBs or space padded in LSBs.
///
///
/// Pointer to a feature values to be used for the segment. Only one
/// feature values may be used for a segment. If NULL the default features
/// for the font will be used.
///
///
/// Specifies what encoding form the string is in (utf8, utf16, utf32)
///
///
/// Start of the string
///
///
/// Number of unicode characters to process in the string. The string will
/// be processed either up to the first NULL or until nChars have been
/// processed. nChars is also used to initialise the internal memory
/// allocations of the segment. So it is wise not to make nChars too much
/// greater than the actual number of characters being processed.
///
///
/// Specifies whether the segment is processed right to left (1) or left to
/// right (0) and whether to run the internal bidi pass, if a font requests it.
/// See enum gr_bidirtl for details.
///
[DllImport("graphite2.dll", EntryPoint="gr_make_seg")]
internal static extern /*gr_segment**/IntPtr MakeSeg(/*gr_font**/IntPtr font, /*gr_face**/IntPtr face, UInt32 script, /*gr_feature_val**/IntPtr pFeats, Encform enc, IntPtr pStart, int nChars, Bidirtl dir);
///
/// Destroys a segment, freeing the memory.
///
///
/// The segment to destroy
///
[DllImport("graphite2.dll", EntryPoint="gr_seg_destroy")]
internal static extern void SegDestroy(/*gr_segment**/IntPtr p);
///
/// Returns the advance for the whole segment.
///
///
/// Returns the width of the segment up to the next glyph origin after the segment
///
[DllImport("graphite2.dll", EntryPoint="gr_seg_advance_X")]
internal static extern float SegAdvanceX(/*gr_segment**/IntPtr pSeg/*not NULL*/);
///
/// Returns the height advance for the segment.
///
[DllImport("graphite2.dll", EntryPoint="gr_seg_advance_Y")]
internal static extern float SegAdvanceY(/*gr_segment**/IntPtr pSeg/*not NULL*/);
///
/// Returns the number of gr_char_infos in the segment.
///
[DllImport("graphite2.dll", EntryPoint="gr_seg_n_cinfo")]
internal static extern uint SegNCinfo(/*gr_segment**/IntPtr pSeg/*not NULL*/);
///
/// Returns a gr_char_info at a given index in the segment.
///
[DllImport("graphite2.dll", EntryPoint="gr_seg_cinfo")]
internal static extern /*gr_char_info**/IntPtr SegCinfo(/*gr_segment*/IntPtr pSeg/*not NULL*/, uint index/*must be
/// Returns the number of glyph gr_slots in the segment.
///
[DllImport("graphite2.dll", EntryPoint="gr_seg_n_slots")]
internal static extern uint SegNSlots(/*gr_segment**/IntPtr pSeg/*not NULL*/); //one slot per glyph
///
/// Returns the first gr_slot in the segment.
///
/// The first slot in a segment has a gr_slot_prev_in_segment() of NULL. Slots are owned
/// by their segment and are destroyed along with the segment.
///
[DllImport("graphite2.dll", EntryPoint="gr_seg_first_slot")]
internal static extern /*gr_slot*/IntPtr SegFirstSlot(/*gr_segment**/IntPtr pSeg/*not NULL*/); //may give a base slot or a slot which is attached to another
///
/// Returns the last gr_slot in the segment.
///
/// The last slot in a segment has a gr_slot_next_in_segment() of NULL
///
[DllImport("graphite2.dll", EntryPoint="gr_seg_last_slot")]
internal static extern /*gr_slot**/IntPtr SegLastSlot(/*gr_segment**/IntPtr pSeg/*not NULL*/); //may give a base slot or a slot which is attached to another
///
/// Justifies a linked list of slots for a line to a given width
///
/// Passed a pointer to the start of a linked list of slots corresponding to a line, as
/// set up by gr_slot_linebreak_before, this function will position the glyphs in the line
/// to take up the given width. It is possible to specify a subrange within the line to process.
/// This allows skipping of line initial or final whitespace, for example. While this will ensure
/// that the subrange fits width, the line will still be positioned with the first glyph of the
/// line at 0. So the resulting positions may be beyond width.
///
///
/// Pointer to the segment
///
///
/// Pointer to the start of the line linked list (including skipped characters)
///
///
/// Font to use for positioning
///
///
/// Width in pixels in which to fit the line
///
///
/// Indicates line ending types. Default is linked list is a full line
///
///
/// If not NULL, the first slot in the list to be considered part of the line (so can skip)
///
///
/// If not NULL, the last slot to process in the line (allow say trailing whitespace to be skipped)
///
[DllImport("graphite2.dll", EntryPoint="gr_seg_justify")]
internal static extern void SegJustify(/*gr_segment**/IntPtr pSeg/*not NULL*/, /*gr_slot**/IntPtr pStart/*not NULL*/, /*gr_font **/ IntPtr pFont, double width, JustFlags flags, /*gr_slot**/IntPtr pFirst, /*gr_slot**/IntPtr pLast);
///
/// Returns the next slot along in the segment.
///
/// Slots are held in a linked list. This returns the next in the linked list. The slot
/// may or may not be attached to another slot. Returns NULL at the end of the segment.
///
[DllImport("graphite2.dll", EntryPoint="gr_slot_next_in_segment")]
internal static extern /*gr_slot**/IntPtr SlotNextInSegment(/*gr_slot**/ IntPtr p);
///
/// Returns the previous slot along in the segment.
///
/// Slots are held in a doubly linked list. This returns the previos slot in the linked
/// list. This slot may or may not be attached to it. Returns NULL at the start of the
/// segment.
///
[DllImport("graphite2.dll", EntryPoint="gr_slot_prev_in_segment")]
internal static extern /*gr_slot**/IntPtr SlotPrevInSegment(/*gr_slot**/IntPtr p);
///
/// Returns the attachment parent slot of this slot.
///
/// Attached slots form a tree. This returns the parent of this slot in that tree. A
/// base glyph which is not attached to another glyph, always returns NULL.
///
[DllImport("graphite2.dll", EntryPoint="gr_slot_attached_to")]
internal static extern /*gr_slot**/IntPtr SlotAttachedTo(/*gr_slot**/IntPtr p);
///
/// Returns the first slot attached to this slot.
///
/// Attached slots form a singly linked list from the parent. This returns the first
/// slot in that list. Note that this is a reference to another slot that is also in
/// the main segment doubly linked list.
///
/// if gr_slot_first_attachment(p) != NULL then gr_slot_attached_to(gr_slot_first_attachment(p)) == p.
///
[DllImport("graphite2.dll", EntryPoint="gr_slot_first_attachment")]
internal static extern /*gr_slot**/IntPtr SlotFirstAttachment(/*gr_slot**/IntPtr p);
///
/// Returns the next slot attached to our attachment parent.
///
/// This returns the next slot in the singly linked list of slots attached to this
/// slot's parent. If there are no more such slots, NULL is returned. If there is
/// no parent, i.e. the passed slot is a base, then the next base in graphical order
/// (ltr even for rtl text) is returned.
///
/// if gr_slot_next_sibling_attachment(p) != NULL then gr_slot_attached_to(gr_slot_next_sibling_attachment(p)) == gr_slot_attached_to(p).
///
[DllImport("graphite2.dll", EntryPoint="gr_slot_next_sibling_attachment")]
internal static extern /*gr_slot**/IntPtr SlotNextSiblingAttachment(/*gr_slot**/IntPtr p);
///
/// Returns glyph id of the slot
///
/// Each slot has a glyphid which is rendered at the position given by the slot. This
/// glyphid is the real glyph to be rendered and never a pseudo glyph.
///
[DllImport("graphite2.dll", EntryPoint="gr_slot_gid")]
internal static extern ushort SlotGid(/*gr_slot**/IntPtr p);
///
/// Returns X offset of glyph from start of segment
///
[DllImport("graphite2.dll", EntryPoint="gr_slot_origin_X")]
internal static extern float SlotOriginX(/*gr_slot**/IntPtr p);
///
/// Returns Y offset of glyph from start of segment
///
[DllImport("graphite2.dll", EntryPoint="gr_slot_origin_Y")]
internal static extern float SlotOriginY(/*gr_slot**/IntPtr p);
///
/// Returns the glyph advance for this glyph as adjusted for kerning
///
///
/// Slot to give results for
///
///
/// face gr_face of the glyphs. May be NULL if unhinted advances used
///
///
/// font gr_font to scale for pixel results. If NULL returns design units advance. If not NULL then returns pixel advance based on hinted or scaled glyph advances in the font. face must be passed for hinted advances to be used.
///
[DllImport("graphite2.dll", EntryPoint="gr_slot_advance_X")]
internal static extern float SlotAdvanceX(/*gr_slot**/IntPtr p, /*gr_face**/IntPtr face, /*gr_font **/IntPtr font);
///
/// Returns the vertical advance for the glyph in the slot adjusted for kerning
///
/// Returns design units unless font is not NULL in which case the pixel value is returned scaled for the given font
///
[DllImport("graphite2.dll", EntryPoint="gr_slot_advance_Y")]
internal static extern float SlotAdvanceY(/*gr_slot**/IntPtr p, /*gr_face**/IntPtr face, /*gr_font **/IntPtr font);
///
/// Returns the gr_char_info index before us
///
/// Returns the index of the gr_char_info that a cursor before this slot, would put
/// an underlying cursor before.
///
[DllImport("graphite2.dll", EntryPoint="gr_slot_before")]
internal static extern int SlotBefore(/*gr_slot**/IntPtr p/*not NULL*/);
///
/// Returns the gr_char_info index after us
///
/// Returns the index of the gr_char_info that a cursor after this slot would put an
/// underlying cursor after.
///
[DllImport("graphite2.dll", EntryPoint="gr_slot_after")]
internal static extern int SlotAfter(/*gr_slot**/IntPtr p/*not NULL*/);
///
/// Returns the index of this slot in the segment
///
/// Returns the index given to this slot during final positioning. This corresponds to the value returned br gr_cinfo_before()
/// and gr_cinfo_after()
///
[DllImport("graphite2.dll", EntryPoint="gr_slot_index")]
internal static extern uint SlotIndex(/*gr_slot**/IntPtr p/*not NULL*/);
///
/// Return a slot attribute value
///
/// Given a slot and an attribute along with a possible subattribute, return the
/// corresponding value in the slot. See enum gr_attrCode for details of each attribute.
///
[DllImport("graphite2.dll", EntryPoint="gr_slot_attr")]
internal static extern int SlotAttr(/*gr_slot**/IntPtr p/*not NULL*/, /*gr_segment**/IntPtr pSeg/*not NULL*/, AttrCode index, byte subindex); //tbd - do we need to expose this?
///
/// Returns whether text may be inserted before this glyph [check this isn't inverted]
///
[DllImport("graphite2.dll", EntryPoint="gr_slot_can_insert_before")]
internal static extern int SlotCanInsertBefore(/*gr_slot**/IntPtr p);
///
/// Returns the original gr_char_info index this slot refers to.
///
/// Each Slot has a gr_char_info that it originates from. This is that gr_char_info. The index is passed to gr_seg_cinfo(). This
/// information is useful for testing.
///
[DllImport("graphite2.dll", EntryPoint="gr_slot_original")]
internal static extern int SlotOriginal(/*gr_slot**/IntPtr p/*not NULL*/);
///
/// Breaks a segment into lines.
///
/// Breaks the slot linked list at the given point in the linked list. It is up
/// to the application to keep track of the first slot on each line.
///
[DllImport("graphite2.dll", EntryPoint="gr_slot_linebreak_before")]
internal static extern void SlotLinebreakBefore(/*gr_slot **/ IntPtr p/*not NULL*/);
#endregion
#region Log methods
///
/// Start logging all segment creation and updates on the provided face. This
/// is logged to a JSON file, see "Segment JSON Schema.txt" for a precise
/// definition of the file
///
///
/// true if the file was successfully created and logging is correctly initialised.
///
///
/// the gr_face whose segments you want to log to the given file
///
///
/// a utf8 encoded file name and path to log to.
///
[DllImport("graphite2.dll", EntryPoint="gr_start_logging", CharSet = CharSet.Ansi)]
internal static extern bool StartLogging(/*gr_face **/IntPtr face, string log_path);
///
/// GStop logging on the given face. This will close the log file created by
/// gr_start_logging.
///
///
/// the gr_face whose segments you want to stop logging
///
[DllImport("graphite2.dll", EntryPoint="gr_stop_logging", CharSet = CharSet.Ansi)]
internal static extern void StopLogging(/*gr_face **/IntPtr face);
#endregion
}
}