public static IGeometry TransformByBaseline(IGeometry g, IGeometry destBaseline)
        {
            var env  = g.EnvelopeInternal;
            var src0 = new Coordinate(env.MinX, env.MinY);
            var src1 = new Coordinate(env.MaxX, env.MinY);

            var destPts = destBaseline.Coordinates;
            var dest0   = destPts[0];
            var dest1   = destPts[1];
            var trans   = AffineTransformationFactory.CreateFromBaseLines(src0, src1, dest0, dest1);

            return(trans.Transform(g));
        }
        private static IGeometry FontGlyph(IGeometry g, String text, Font font)
        {
            var env      = FunctionsUtil.GetEnvelopeOrDefault(g);
            var geomFact = FunctionsUtil.GetFactoryOrDefault(g);

            var textGeom = FontGlyphReader.Read(text, font, geomFact);
            var envText  = textGeom.EnvelopeInternal;

            if (g != null)
            {
                // transform to baseline
                var baseText0 = new Coordinate(envText.MinX, envText.MinY);
                var baseText1 = new Coordinate(envText.MaxX, envText.MinY);
                var baseGeom0 = new Coordinate(env.MinX, env.MinY);
                var baseGeom1 = new Coordinate(env.MaxX, env.MinY);
                AffineTransformation trans = AffineTransformationFactory.CreateFromBaseLines(baseText0, baseText1,
                                                                                             baseGeom0, baseGeom1);
                return(trans.Transform(textGeom));
            }
            return(textGeom);
        }