Esempio n. 1
0
        public void Justify(Slot start, Font font, double width, JustFlags flags, Slot first, Slot last)
        {
            IntPtr firstPtr = first != null ? first.SlotPtr : IntPtr.Zero;
            IntPtr lastPtr  = last != null ? last.SlotPtr : IntPtr.Zero;

            Graphite2Api.SegJustify(_segment, start.SlotPtr, font.FontPtr, width, flags, firstPtr, lastPtr);
        }
Esempio n. 2
0
        public FeatureRef FindFref(Int32 featid)
        {
            IntPtr ptr = Graphite2Api.FaceFindFref(_face, featid);

            if (ptr == IntPtr.Zero)
            {
                return(null);
            }
            return(new FeatureRef(ptr));
        }
Esempio n. 3
0
        public FeatureRef Fref(UInt16 i)
        {
            IntPtr ptr = Graphite2Api.FaceFref(_face, i);

            if (ptr == IntPtr.Zero)
            {
                return(null);
            }
            return(new FeatureRef(ptr));
        }
Esempio n. 4
0
        public string ValueLabel(UInt16 settingsno, string langid, Encform utf)
        {
            UInt32 length;
            ushort langId   = (ushort)Graphite2Api.StrToTag(langid);
            IntPtr labelPtr = Graphite2Api.FrefValueLabel(_featureRef, settingsno, ref langId, utf, out length);
            string retLabel = ConvertGraphiteLabelToString(labelPtr, utf, length);

            Graphite2Api.LabelDestroy(labelPtr);
            return(retLabel);
        }
Esempio n. 5
0
        public Featureval FeaturevalForLang(string lang)
        {
            IntPtr ptr = Graphite2Api.FaceFeaturevalForLang(_face, Graphite2Api.StrToTag(lang));

            if (ptr == IntPtr.Zero)
            {
                return(null);
            }
            return(new Featureval(ptr));
        }
Esempio n. 6
0
        public Segment MakeSeg(UInt32 script, Featureval feats, string str, Bidirtl dir)
        {
            IntPtr strPtr        = Marshal.StringToCoTaskMemUni(str);
            IntPtr error         = new IntPtr(0);
            int    numCodePoints = Graphite2Api.CountUnicodeCharacters(Encform.Utf16, strPtr, IntPtr.Zero, ref error);
            IntPtr segmentPtr    = Graphite2Api.MakeSeg(_font, _face.FacePtr, script, feats.FeatureValPtr, Encform.Utf16, strPtr, numCodePoints, dir);

            Marshal.FreeCoTaskMem(strPtr);
            return(new Segment(segmentPtr));
        }
Esempio n. 7
0
        public CharInfo Cinfo(uint index)
        {
            IntPtr charInfoPtr = Graphite2Api.SegCinfo(_segment, index);

            if (charInfoPtr == IntPtr.Zero)
            {
                return(null);
            }

            return(new CharInfo(charInfoPtr));
        }
Esempio n. 8
0
        public bool StartLogging(string filename)
        {
            int major, minor, bugfix;

            Graphite2Api.EngineVersion(out major, out minor, out bugfix);

            if (major <= 1 && minor < 2)
            {
                throw new NotSupportedException("A newer graphite engine is needed to support logging");
            }

            return(Graphite2Api.StartLogging(_face, filename));
        }
Esempio n. 9
0
        public void StopLogging()
        {
            int major, minor, bugfix;

            Graphite2Api.EngineVersion(out major, out minor, out bugfix);

            if (major <= 1 && minor < 2)
            {
                throw new NotSupportedException("A newer graphite engine is needed to support logging");
            }

            Graphite2Api.StopLogging(_face);
        }
Esempio n. 10
0
        public Face(string filename, uint segCacheMaxSize, FaceOptions options)
        {
            if (!File.Exists(filename))
            {
                throw new ArgumentException("filename");
            }

            _face = Graphite2Api.MakeFileFaceWithSegCache(filename, segCacheMaxSize, options);

            if (_face == IntPtr.Zero)
            {
                throw new ArgumentException("filename is not a graphite font");
            }
        }
Esempio n. 11
0
        public string Label(string langid, Encform utf)
        {
            UInt32 length;
            ushort langId   = (ushort)Graphite2Api.StrToTag(langid);
            IntPtr labelPtr = Graphite2Api.FrefLabel(_featureRef, ref langId, utf, out length);

            if (labelPtr == IntPtr.Zero)
            {
                return(String.Empty);
            }
            string retLabel = ConvertGraphiteLabelToString(labelPtr, utf, length);

            Graphite2Api.LabelDestroy(labelPtr);
            return(retLabel);
        }
Esempio n. 12
0
        /// <summary>
        /// Determins if filename is a graphite font or not.
        /// </summary>
        public static bool IsGraphiteFont(string filename)
        {
            if (!File.Exists(filename))
            {
                return(false);
            }

            IntPtr face = Graphite2Api.MakeFileFace(filename, FaceOptions.face_default);

            if (face == IntPtr.Zero)
            {
                return(false);
            }

            Graphite2Api.FaceDestroy(face);
            return(true);
        }
Esempio n. 13
0
 public void Dispose()
 {
     Graphite2Api.FaceDestroy(_face);
 }
Esempio n. 14
0
 public void Dispose()
 {
     Graphite2Api.FontDestroy(_font);
 }
Esempio n. 15
0
 public UInt16 NValues()
 {
     return(Graphite2Api.FrefNValues(_featureRef));
 }
Esempio n. 16
0
 public void Dispose()
 {
     Graphite2Api.SegDestroy(_segment);
 }
Esempio n. 17
0
 public UInt32 LangByIndex(UInt16 i)
 {
     return(Graphite2Api.FaceLangByIndex(_face, i));
 }
Esempio n. 18
0
 public short NGlyphs()
 {
     return(Graphite2Api.FaceNGlyphs(_face));
 }
Esempio n. 19
0
 public void Dispose()
 {
     Graphite2Api.FeatureValDestroy(_featureval);
 }
Esempio n. 20
0
 public ushort NLanguages()
 {
     return(Graphite2Api.FaceNLanguages(_face));
 }
Esempio n. 21
0
 public UInt16 Value(UInt16 settingno)
 {
     return(Graphite2Api.FrefValue(_featureRef, settingno));
 }
Esempio n. 22
0
 public UInt16 FeatureValue(Featureval feats)
 {
     return(Graphite2Api.FrefFeatureValue(_featureRef, feats.FeatureValPtr));
 }
Esempio n. 23
0
 public UInt16 NFref()
 {
     return(Graphite2Api.FaceNFref(_face));
 }
Esempio n. 24
0
 public float AdvanceY(Face face, Font font)
 {
     return(Graphite2Api.SlotAdvanceY(_slot, face.FacePtr, font.FontPtr));
 }
Esempio n. 25
0
 public int SetFeatureValue(UInt16 val, Featureval dest)
 {
     return(Graphite2Api.FrefSetFeatureValue(_featureRef, val, dest.FeatureValPtr));
 }
Esempio n. 26
0
 public int Attr(Segment seg, AttrCode index, byte subindex)
 {
     return(Graphite2Api.SlotAttr(_slot, seg.SegPtr, index, subindex));
 }
Esempio n. 27
0
 public Featureval Clone()
 {
     return(new Featureval(Graphite2Api.FeaturevalClone(_featureval)));
 }
Esempio n. 28
0
 public void LineBreakBefore()
 {
     Graphite2Api.SlotLinebreakBefore(_slot);
 }
Esempio n. 29
0
 public Font(float ppm, Face face)
 {
     _face = face;
     _font = Graphite2Api.MakeFont(ppm, _face.FacePtr);
 }