Ejemplo n.º 1
0
        // Compute the Bounding Box of multilines
        public BBox Measure(string[] lines, float interline)
        {
            Outline.Point position       = new Outline.Point(); // start at 0,0
            Outline.Point lineTransition = new Outline.Point(0, -Height * interline);

            BBox bbox = new BBox();

            foreach (string line in lines)
            {
                BBox lbox = Measure(line);
                lbox.Translate(position);
                bbox.Merge(lbox);
                position.Translate(lineTransition);
            }

            return(bbox);
        }
Ejemplo n.º 2
0
        // Compute the Bounding Box a text line
        public BBox Measure(string txt)
        {
            BBox bbox = new BBox();

            Outline.Point advance = new Outline.Point();

            foreach (char c in txt)
            {
                Outline.Point cadv;
                BBox          cbbox = Measure(c, out cadv);

                // translate char bbox to total advancement so far
                cbbox.Translate(advance);

                bbox.Merge(cbbox);

                // add char adv to total adv
                advance.Translate(cadv);
            }

            return(bbox);
        }
Ejemplo n.º 3
0
        // Compute the Bounding Box of multilines
        public BBox Measure(string[] lines, float interline)
        {
            Outline.Point position = new Outline.Point(); // start at 0,0
            Outline.Point lineTransition = new Outline.Point(0, - Height * interline);

            BBox bbox = new BBox();

            foreach (string line in lines)
            {
                BBox lbox = Measure(line);
                lbox.Translate(position);
                bbox.Merge(lbox);
                position.Translate(lineTransition);
            }

            return bbox;
        }
Ejemplo n.º 4
0
        // Compute the Bounding Box a text line
        public BBox Measure(string txt)
        {
            BBox bbox = new BBox();
            Outline.Point advance = new Outline.Point();

            foreach (char c in txt)
            {
                Outline.Point cadv;
                BBox cbbox = Measure(c, out cadv);

                // translate char bbox to total advancement so far
                cbbox.Translate(advance);

                bbox.Merge(cbbox);

                // add char adv to total adv
                advance.Translate(cadv);
            }

            return bbox;
        }