public void PerTestSetup()
 {
     _face = new Face(TestConstants.PaduakFontLocation, FaceOptions.face_default);
     _font = new Font(20.0f, _face);
     _featureval = _face.FeaturevalForLang("en");
     _segment = _font.MakeSeg(0, _featureval, "hello world", Bidirtl.Nobidi);
 }
 public void Font_FromTestFace_DoesNotThrowException()
 {
     using (var face = new Face(TestConstants.PaduakFontLocation, FaceOptions.face_default))
     {
         new Font(20.0f, face).Dispose();
     }
 }
 public void FindFref_FindFreatureForkdotString_ReturnsNonNullFeatureRef()
 {
     using (var face = new Face(TestConstants.PaduakFontLocation, FaceOptions.face_default))
     {
         FeatureRef featureRef = face.FindFref(1801744244);
         Assert.NotNull(featureRef);
     }
 }
 public void Fref_PaduakFace_ReturnNonNullFeatureRef()
 {
     using (var face = new Face(TestConstants.PaduakFontLocation, FaceOptions.face_default))
     {
         FeatureRef featureRef = face.Fref(0);
         Assert.NotNull(featureRef);
     }
 }
 public void FeaturevalForLang_EnLang_ReturnsNonNullFeatureval()
 {
     using (var face = new Face(TestConstants.PaduakFontLocation, FaceOptions.face_default))
     {
         Featureval val = face.FeaturevalForLang("en");
         Assert.NotNull(val);
     }
 }
 public void MakeSeg_WithTestString_ReturnsNonNullSegment()
 {
     using (var face = new Face(TestConstants.PaduakFontLocation, FaceOptions.face_default))
     {
         using (var font = new Font(20.0f, face))
         {
             using(Featureval featureval = face.FeaturevalForLang("en"))
             {
                 Segment segment = font.MakeSeg(0, featureval, "hello world", Bidirtl.Nobidi);
                 Assert.NotNull(segment);
                 segment.Dispose();
             }
         }
     }
 }
        public void EnumerateAllFeaturesInAFont()
        {
            var idDescDictionary = new Dictionary<string, string>();

            using (var face = new Face(TestConstants.PaduakFontLocation, FaceOptions.face_default))
            {
                for(int i = 0; i < face.NFref(); i++)
                {
                    var featureRef = face.Fref((ushort)i);
                    var refLabel = featureRef.Label("en", Encform.Utf16);

                    idDescDictionary.Add(featureRef.IdLabel, refLabel);
                }
            }

            string val;
            idDescDictionary.TryGetValue("kdot", out val);
            Assert.AreEqual("Khamti style dots", val);

            idDescDictionary.TryGetValue("nnya", out val);
            Assert.AreEqual("Disable great nnya", val);
        }
 public Font(float ppm, Face face)
 {
     _face = face;
     _font = Graphite2Api.MakeFont(ppm, _face.FacePtr);
 }
 public void PerTestSetup()
 {
     _face = new Face(TestConstants.PaduakFontLocation, FaceOptions.face_default);
 }
Example #10
0
 public Font(float ppm, Face face)
 {
     _face = face;
     _font = Graphite2Api.MakeFont(ppm, _face.FacePtr);
 }
 public void LangByIndex_PaduakFaceIndexZero_ReturnsNonZeroLangId()
 {
     using (var face = new Face(TestConstants.PaduakFontLocation, FaceOptions.face_default))
     {
         Assert.AreNotEqual(0, face.LangByIndex(0));
     }
 }
        public void StartLogging_PaduakFace_LogFileIsCreated()
        {
            int major, minor, bugfix;
            Graphite2Api.EngineVersion(out major, out minor, out bugfix);

            if (major <= 1 && minor < 2)
            {
                using (var face = new Face(TestConstants.PaduakFontLocation, FaceOptions.face_default))
                {
                    Assert.Throws<NotSupportedException>(() => face.StartLogging(String.Empty));
                    Assert.Throws<NotSupportedException>(() => face.StopLogging());
                }
                return;
            }

            using (var face = new Face(TestConstants.PaduakFontLocation, FaceOptions.face_default))
            {
                string filename = Path.GetTempPath() + Guid.NewGuid().ToString();
                Assert.IsTrue(face.StartLogging(filename));
                Assert.IsTrue(File.Exists(filename));
                face.StopLogging();
                File.Delete(filename);
            }
        }
 public void NLanguages_PaduakFace_ReturnsExpectedNumberOfLanguages()
 {
     using (var face = new Face(TestConstants.PaduakFontLocation, FaceOptions.face_default))
     {
         Assert.AreEqual(3, face.NLanguages());
     }
 }
 public void NFref_PaduakFace_ReturnNineOrMoreFeatures()
 {
     using (var face = new Face(TestConstants.PaduakFontLocation, FaceOptions.face_default))
     {
         Assert.GreaterOrEqual(face.NFref(), 9);
     }
 }
 public float AdvanceY(Face face, Font font)
 {
     return Graphite2Api.SlotAdvanceY(_slot, face.FacePtr, font.FontPtr);
 }