Esempio n. 1
0
        // }}}
        // GtkRenderer::renderHumanReadable() {{{
        public void renderHumanReadable(HumanReadableElement elm)
        {
            elm.cleanText();

            // font
            Pango.FontDescription font = Pango.FontDescription.FromString(elm.font.name);
            if(elm.font.size > 0) {
                font.Size = elm.font.size * 1024;
            }

            this._layout.FontDescription = font;
            this._layout.SetMarkup("<span color=" + (char)34 + "black" + (char)34 +">" + elm.data + "</span>");

            // rotate the text
            int angle = Conversion.iplRot2degree(elm.fieldDirection);
            Pango.Matrix m = Pango.Matrix.Identity;
            m.Rotate(angle);
            this._layout.Context.Matrix = m;

            double strWidth = elm.width * elm.data.Length;

            // Calcul the real position of the text using the rotation
            double realX = elm.fieldOriginX;
            double realY = elm.fieldOriginY;
            if(angle == 90) {
                realX = realX - elm.height;
                realY = realY - strWidth;
            } else if(angle == 180) {
                realX = realX - strWidth;
                realY = realY - elm.height;
            } else if(angle == 270) {
                realX = realX - elm.height;
            }
            // draw the text
            this._da.GdkWindow.DrawLayout(this._da.Style.BaseGC(StateType.Normal),
                    (int)Conversion.dot2px(realX), (int)Conversion.dot2px(realY), this._layout);
        }