コード例 #1
0
ファイル: Outline.cs プロジェクト: blockspacer/FrankE
        /// <summary>
        /// Apply a simple 2x2 matrix to all of an outline's points. Useful for applying rotations, slanting, flipping,
        /// etc.
        /// </summary>
        /// <remarks>
        /// You can use <see cref="Translate"/> if you need to translate the outline's points.
        /// </remarks>
        /// <param name="matrix">A pointer to the transformation matrix.</param>
        public void Transform(FTMatrix matrix)
        {
            if (disposed)
            {
                throw new ObjectDisposedException("Outline", "Cannot access a disposed object.");
            }

            FT.FT_Outline_Transform(reference, ref matrix);
        }
コード例 #2
0
        /// <summary>
        /// Transform a glyph image if its format is scalable.
        /// </summary>
        /// <param name="matrix">A pointer to a 2x2 matrix to apply.</param>
        /// <param name="delta">
        /// A pointer to a 2d vector to apply. Coordinates are expressed in 1/64th of a pixel.
        /// </param>
        public void Transform(FTMatrix matrix, FTVector delta)
        {
            Error err = FT.FT_Glyph_Transform(Reference, ref matrix, ref delta);

            if (err != Error.Ok)
            {
                throw new FreeTypeException(err);
            }
        }
コード例 #3
0
        /// <summary>
        /// Transform a glyph image if its format is scalable.
        /// </summary>
        /// <param name="matrix">A pointer to a 2x2 matrix to apply.</param>
        /// <param name="delta">
        /// A pointer to a 2d vector to apply. Coordinates are expressed in 1/64th of a pixel.
        /// </param>
        public void Transform(FTMatrix matrix, FTVector delta)
        {
            if (disposed)
            {
                throw new ObjectDisposedException("Glyph", "Cannot access a disposed object.");
            }

            Error err = FT.FT_Glyph_Transform(Reference, ref matrix, ref delta);

            if (err != Error.Ok)
            {
                throw new FreeTypeException(err);
            }
        }
コード例 #4
0
 /// <summary>
 /// Transform a single vector through a 2x2 matrix.
 /// </summary>
 /// <remarks>
 /// The result is undefined if either ‘vector’ or ‘matrix’ is invalid.
 /// </remarks>
 /// <param name="matrix">A pointer to the source 2x2 matrix.</param>
 public void Transform(FTMatrix matrix)
 {
     FT.FT_Vector_Transform(ref this, ref matrix);
 }
コード例 #5
0
ファイル: Glyph.cs プロジェクト: none53/SharpFont
		/// <summary>
		/// Transform a glyph image if its format is scalable.
		/// </summary>
		/// <param name="matrix">A pointer to a 2x2 matrix to apply.</param>
		/// <param name="delta">
		/// A pointer to a 2d vector to apply. Coordinates are expressed in 1/64th of a pixel.
		/// </param>
		public void Transform(FTMatrix matrix, FTVector delta)
		{
			if (disposed)
				throw new ObjectDisposedException("Glyph", "Cannot access a disposed object.");

			Error err = FT.FT_Glyph_Transform(Reference, ref matrix, ref delta);

			if (err != Error.Ok)
				throw new FreeTypeException(err);
		}
コード例 #6
0
ファイル: GlyphSlot.cs プロジェクト: SirusDoma/Genode
        public void GetSubGlyphInfo(uint subIndex, out int index, out SubGlyphFlags flags, out int arg1, out int arg2, out FTMatrix transform)
        {
            Error err = FT.FT_Get_SubGlyph_Info(Reference, subIndex, out index, out flags, out arg1, out arg2, out transform);

            if (err != Error.Ok)
            {
                throw new FreeTypeException(err);
            }
        }
コード例 #7
0
ファイル: FT.Internal.cs プロジェクト: Mailaender/SharpFont
 internal static extern void FT_Set_Transform(IntPtr face, ref FTMatrix matrix, ref FTVector delta);
コード例 #8
0
 internal static extern void FT_Matrix_Multiply(ref FTMatrix a, ref FTMatrix b);
コード例 #9
0
 internal static extern void FT_Outline_Transform(IntPtr outline, ref FTMatrix matrix);
コード例 #10
0
 internal static extern Error FT_Glyph_Transform(IntPtr glyph, ref FTMatrix matrix, ref FTVector delta);
コード例 #11
0
 internal static extern Error FT_Glyph_Transform(IntPtr glyph, ref FTMatrix matrix, ref FTVector delta);
コード例 #12
0
ファイル: GlyphSlot.cs プロジェクト: none53/SharpFont
		public void GetSubGlyphInfo(uint subIndex, out int index, out SubGlyphFlags flags, out int arg1, out int arg2, out FTMatrix transform)
		{
			Error err = FT.FT_Get_SubGlyph_Info(Reference, subIndex, out index, out flags, out arg1, out arg2, out transform);

			if (err != Error.Ok)
				throw new FreeTypeException(err);
		}
コード例 #13
0
 internal static extern Error FT_Get_SubGlyph_Info(IntPtr glyph, uint sub_index, out int p_index, out SubGlyphFlags p_flags, out int p_arg1, out int p_arg2, out FTMatrix p_transform);
コード例 #14
0
ファイル: FTVector.cs プロジェクト: Mailaender/SharpFont
 /// <summary>
 /// Transform a single vector through a 2x2 matrix.
 /// </summary>
 /// <remarks>
 /// The result is undefined if either ‘vector’ or ‘matrix’ is invalid.
 /// </remarks>
 /// <param name="matrix">A pointer to the source 2x2 matrix.</param>
 public void Transform(FTMatrix matrix)
 {
     FT.FT_Vector_Transform(ref this, ref matrix);
 }
コード例 #15
0
 /// <summary>
 /// Apply a simple 2x2 matrix to all of an outline's points. Useful for applying rotations, slanting, flipping,
 /// etc.
 /// </summary>
 /// <remarks>
 /// You can use <see cref="Translate"/> if you need to translate the outline's points.
 /// </remarks>
 /// <param name="matrix">A pointer to the transformation matrix.</param>
 public void Transform(FTMatrix matrix) =>
 FT.FT_Outline_Transform(Reference, ref matrix);
コード例 #16
0
ファイル: Outline.cs プロジェクト: none53/SharpFont
		/// <summary>
		/// Apply a simple 2x2 matrix to all of an outline's points. Useful for applying rotations, slanting, flipping,
		/// etc.
		/// </summary>
		/// <remarks>
		/// You can use <see cref="Translate"/> if you need to translate the outline's points.
		/// </remarks>
		/// <param name="matrix">A pointer to the transformation matrix.</param>
		public void Transform(FTMatrix matrix)
		{
			if (disposed)
				throw new ObjectDisposedException("Outline", "Cannot access a disposed object.");

			FT.FT_Outline_Transform(reference, ref matrix);
		}
コード例 #17
0
ファイル: Compat.cs プロジェクト: HinTak/Font-Validator
        public bool RastTest(int resX, int resY, int[] arrPointSizes,
                             float stretchX, float stretchY,
                             float rotation, float skew,
                             float[,] matrix,
                             bool setBW, bool setGrayscale, bool setCleartype, uint CTFlags,
                             RastTestErrorDelegate pRastTestErrorDelegate,
                             UpdateProgressDelegate pUpdateProgressDelegate,
                             int numGlyphs)
        {
            int count_sets = 0;
            LoadFlags lf = LoadFlags.Default;
            LoadTarget lt = LoadTarget.Normal;
            if ( setBW )
            {
                lf = LoadFlags.Default|LoadFlags.NoAutohint|LoadFlags.Monochrome|LoadFlags.ComputeMetrics;
                lt = LoadTarget.Mono;
                _lib.PropertySet("truetype", "interpreter-version", 35);

                count_sets++;
            }
            if ( setGrayscale )
            {
                lf = LoadFlags.Default|LoadFlags.NoAutohint|LoadFlags.ComputeMetrics;
                lt = LoadTarget.Normal;
                _lib.PropertySet("truetype", "interpreter-version", 35);

                count_sets++;
            }
            if ( setCleartype )
            {
                lf = LoadFlags.Default|LoadFlags.NoAutohint|LoadFlags.ComputeMetrics;
                lt = LoadTarget.Lcd;
                _lib.PropertySet("truetype", "interpreter-version", 40);

                count_sets++;
            }
            if ( count_sets != 1 )
                throw new ArgumentOutOfRangeException("Only one of BW/Grayscale/Cleartype should be set");

            try
            {
                TT_Diagnostics_Unset();
            }
            catch (Exception e)
            {
                throw new NotImplementedException("UnImplemented in this version of Freetype: " + FTVersion);
            };

            FTMatrix fmatrix = new FTMatrix(new Fixed16Dot16( matrix[0,0] * stretchX ), new Fixed16Dot16( matrix[0,1] * stretchX ),
                                            new Fixed16Dot16( matrix[1,0] * stretchY ), new Fixed16Dot16( matrix[1,1] * stretchY ));
            FTVector fdelta = new FTVector(new Fixed16Dot16( matrix[0,2] * stretchX ), new Fixed16Dot16( matrix[1,2] * stretchY ));
            /* matrix[2,0] = matrix[2,1] = 0, matrix[2,2] =1, not used */

            FTMatrix mskew = new FTMatrix(new Fixed16Dot16( 1 ), new Fixed16Dot16( 0 ),
                                          (new Fixed16Dot16(skew)).Tan(), new Fixed16Dot16( 1 ));
            FTMatrix.Multiply(ref mskew, ref fmatrix);
            fdelta.Transform(mskew);

            FTVector rot_row1 = new FTVector(new Fixed16Dot16( 1 ), new Fixed16Dot16( 0 ));
            FTVector rot_row2 = new FTVector(new Fixed16Dot16( 1 ), new Fixed16Dot16( 0 ));
            rot_row1.Rotate(new Fixed16Dot16(rotation));
            rot_row2.Rotate(new Fixed16Dot16(rotation + 90));
            FTMatrix mrot = new FTMatrix(rot_row1, rot_row2);
            FTMatrix.Multiply(ref mrot, ref fmatrix);
            fdelta.Rotate(new Fixed16Dot16(-rotation));

            for (int i = 0; i < arrPointSizes.Length ; i++)
            {
                if ( m_UserCancelledTest ) return true;
                pUpdateProgressDelegate("Processing Size " + arrPointSizes[i]);
                _face.SetCharSize(new Fixed26Dot6(arrPointSizes[i]),
                                  new Fixed26Dot6(arrPointSizes[i]),
                                  (uint) resX, (uint) resY);
                _face.SetTransform(fmatrix, fdelta);
                for (uint ig = 0; ig < numGlyphs; ig++) {
                    diagnostics_Function diagnostics =
                        (message, opcode, range_base, is_composite, IP, callTop, opc, start) =>
                        {
                            string sDetails = "Size " + arrPointSizes[i] + ", " + opcode;
                            switch ( range_base )
                            {
                                case 3:
                                    if (is_composite != 0)
                                        sDetails += ", Composite Glyph ID " + ig;
                                    else
                                        sDetails += ", Glyph ID " + ig;
                                    break;
                                case 1: /* font */
                                case 2: /* cvt */ // ?
                                    sDetails += ", Pre-Program";
                                    break;
                                default: /* none */
                                    sDetails += ", Unknown?"; // ?
                                    break;
                            }

                            sDetails += ", At ByteOffset " + IP;

                            if (callTop > 0)
                                sDetails += ", In function " + opc + " offsetted by " + (IP - start);

                            pRastTestErrorDelegate(message, sDetails);
                            m_RastErrorCount += 1;
                            return 0; // Not used currently.
                        };
                    TT_Diagnostics_Set(diagnostics);
                    _face.LoadGlyph(ig, lf, lt);
                    TT_Diagnostics_Unset();
                }
            }
            return true;
        }
コード例 #18
0
 internal static extern Error FT_Matrix_Invert(ref FTMatrix matrix);
コード例 #19
0
 internal static extern Error FT_Get_SubGlyph_Info(IntPtr glyph, uint sub_index, out int p_index, out SubGlyphFlags p_flags, out int p_arg1, out int p_arg2, out FTMatrix p_transform);
コード例 #20
0
 internal static extern void FT_Matrix_Multiply(ref FTMatrix a, ref FTMatrix b);
コード例 #21
0
 internal static extern void FT_Vector_Transform(ref FTVector vec, ref FTMatrix matrix);
コード例 #22
0
 internal static extern void FT_Outline_Transform(IntPtr outline, ref FTMatrix matrix);
コード例 #23
0
 internal static extern Error FT_Matrix_Invert(ref FTMatrix matrix);
コード例 #24
0
ファイル: Face.cs プロジェクト: Mailaender/SharpFont
        /// <summary>
        /// A function used to set the transformation that is applied to glyph images when they are loaded into a glyph
        /// slot through <see cref="LoadGlyph"/>.
        /// </summary>
        /// <remarks><para>
        /// The transformation is only applied to scalable image formats after the glyph has been loaded. It means that
        /// hinting is unaltered by the transformation and is performed on the character size given in the last call to
        /// <see cref="SetCharSize"/> or <see cref="SetPixelSizes"/>.
        /// </para><para>
        /// Note that this also transforms the ‘face.glyph.advance’ field, but not the values in ‘face.glyph.metrics’.
        /// </para></remarks>
        /// <param name="matrix">A pointer to the transformation's 2x2 matrix. Use 0 for the identity matrix.</param>
        /// <param name="delta">A pointer to the translation vector. Use 0 for the null vector.</param>
        public void SetTransform(FTMatrix matrix, FTVector delta)
        {
            if (disposed)
                throw new ObjectDisposedException("face", "Cannot access a disposed object.");

            FT.FT_Set_Transform(Reference, ref matrix, ref delta);
        }
コード例 #25
0
ファイル: Face.cs プロジェクト: jiangzhonghui/SharpFont
        /// <summary>
        /// A function used to set the transformation that is applied to glyph images when they are loaded into a glyph
        /// slot through <see cref="LoadGlyph"/> with the null vector.
        /// </summary>
        /// <remarks><para>
        /// The transformation is only applied to scalable image formats after the glyph has been loaded. It means that
        /// hinting is unaltered by the transformation and is performed on the character size given in the last call to
        /// <see cref="SetCharSize"/> or <see cref="SetPixelSizes"/>.
        /// </para><para>
        /// Note that this also transforms the ‘face.glyph.advance’ field, but not the values in ‘face.glyph.metrics’.
        /// </para></remarks>
        /// <param name="matrix">
        /// A pointer to the transformation's 2x2 matrix. Use the method overloads for the identity matrix.
        /// </param>
        public unsafe void SetTransform(FTMatrix matrix)
        {
            if (disposed)
                throw new ObjectDisposedException("face", "Cannot access a disposed object.");

            FT.FT_Set_Transform(Reference, (IntPtr)(&matrix), IntPtr.Zero);
        }
コード例 #26
0
ファイル: FTMatrix.cs プロジェクト: Mailaender/SharpFont
 /// <summary>
 /// Perform the matrix operation ‘b = a*b’.
 /// </summary>
 /// <remarks>
 /// The result is undefined if either ‘a’ or ‘b’ is zero.
 /// </remarks>
 /// <param name="a">A pointer to matrix ‘a’.</param>
 /// <param name="b">A pointer to matrix ‘b’.</param>
 public static void Multiply(FTMatrix a, FTMatrix b)
 {
     FT.FT_Matrix_Multiply(ref a, ref b);
 }
コード例 #27
0
 internal static extern void FT_Vector_Transform(ref FTVector vec, ref FTMatrix matrix);
コード例 #28
0
ファイル: FTMatrix.cs プロジェクト: Mailaender/SharpFont
 /// <summary>
 /// Perform the matrix operation ‘b = a*b’.
 /// </summary>
 /// <remarks>
 /// The result is undefined if either ‘a’ or ‘b’ is zero.
 /// </remarks>
 /// <param name="b">A pointer to matrix ‘b’.</param>
 public void Multiply(FTMatrix b)
 {
     FT.FT_Matrix_Multiply(ref this, ref b);
 }