Exemple #1
0
        public void SetControlValueTable(FUnit[] cvt, float scale, float ppem, byte[] cvProgram)
        {
            if (this.scale == scale || cvt == null)
                return;

            if (controlValueTable == null)
                controlValueTable = new float[cvt.Length];
            for (int i = 0; i < cvt.Length; i++)
                controlValueTable[i] = cvt[i] * scale;

            this.scale = scale;
            this.ppem = (int)Math.Round(ppem);
            zp0 = zp1 = zp2 = points;
            state.Reset();
            stack.Clear();

            if (cvProgram != null)
            {
                Execute(new InstructionStream(cvProgram), false, false);

                // save off the CVT graphics state so that we can restore it for each glyph we hint
                if ((state.InstructionControl & InstructionControlFlags.UseDefaultGraphicsState) != 0)
                    cvtState.Reset();
                else
                {
                    // always reset a few fields; copy the reset
                    cvtState = state;
                    cvtState.Freedom = Vector2.UnitX;
                    cvtState.Projection = Vector2.UnitX;
                    cvtState.DualProjection = Vector2.UnitX;
                    cvtState.RoundState = RoundMode.ToGrid;
                    cvtState.Loop = 1;
                }
            }
        }
Exemple #2
0
        public static FUnit[] ReadCvt(DataReader reader, TableRecord[] tables)
        {
            var index = FindTable(tables, FourCC.Cvt);

            if (index == -1)
            {
                return(null);
            }

            reader.Seek(tables[index].Offset);

            var results = new FUnit[tables[index].Length / sizeof(short)];

            for (int i = 0; i < results.Length; i++)
            {
                results[i] = (FUnit)reader.ReadInt16BE();
            }

            return(results);
        }
Exemple #3
0
 public Point(FUnit x, FUnit y)
 {
     X    = x;
     Y    = y;
     Type = PointType.OnCurve;
 }
Exemple #4
0
 //public static FUnit Min (FUnit a, FUnit b) => (FUnit)Math.Min(a.value, b.value);
 public static FUnit Min(FUnit a, FUnit b)
 {
     return((FUnit)Math.Min(a.value, b.value));
 }
Exemple #5
0
 public static FUnit Min(FUnit a, FUnit b) => (FUnit)Math.Min(a.value, b.value);
Exemple #6
0
 public static FUnit Max(FUnit a, FUnit b) => (FUnit)Math.Max(a.value, b.value);
Exemple #7
0
 public Point(FUnit x, FUnit y)
 {
     X = x;
     Y = y;
     Type = PointType.OnCurve;
 }
Exemple #8
0
 //public static FUnit Min (FUnit a, FUnit b) => (FUnit)Math.Min(a.value, b.value);
 public static FUnit Min(FUnit a, FUnit b)
 {
     return (FUnit)Math.Min(a.value, b.value);
 }
Exemple #9
0
        public static FUnit[] ReadCvt(DataReader reader, TableRecord[] tables)
        {
            var index = FindTable(tables, FourCC.Cvt);
            if (index == -1)
                return null;

            reader.Seek(tables[index].Offset);

            var results = new FUnit[tables[index].Length / sizeof(short)];
            for (int i = 0; i < results.Length; i++)
                results[i] = (FUnit)reader.ReadInt16BE();

            return results;
        }