{
    "content": [
        {
            "type": "text",
            "text": "# GD::Text::Wrap (perldoc)\n\n## NAME\n\nGD::Text::Wrap - Wrap strings in boxes\n\n## SYNOPSIS\n\nuse GD;\nuse GD::Text::Wrap;\nmy $gd = GD::Image->new(800,600);\n# allocate colours, do other things.\nmy $text = <<EOSTR;\nLorem ipsum dolor sit amet, consectetuer adipiscing elit,\nsed diam nonummy nibh euismod tincidunt ut laoreet dolore\nmagna aliquam erat volutpat.\nEOSTR\nmy $wrapbox = GDTextWrap->new( $gd,\nlinespace  => 4,\ncolor       => $black,\ntext        => $text,\n);\n$wrapbox->setfont(gdMediumBoldFont);\n$wrapbox->setfont('arial', 12);\n$wrapbox->set(align => 'left', width => 120);\n$wrapbox->draw(10,140);\n$gd->rectangle($wrapbox->getbounds(10,140), $color);\n\n## DESCRIPTION\n\nGD::Text::Wrap provides an object that draws a formatted paragraph of text in a box on a\nGD::Image canvas, using either a builtin GD font or a TrueType font.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS**\n- **NOTES**\n- **BUGS**\n- **TODO**\n- **COPYRIGHT**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "GD::Text::Wrap",
        "section": "",
        "mode": "perldoc",
        "summary": "GD::Text::Wrap - Wrap strings in boxes",
        "synopsis": "use GD;\nuse GD::Text::Wrap;\nmy $gd = GD::Image->new(800,600);\n# allocate colours, do other things.\nmy $text = <<EOSTR;\nLorem ipsum dolor sit amet, consectetuer adipiscing elit,\nsed diam nonummy nibh euismod tincidunt ut laoreet dolore\nmagna aliquam erat volutpat.\nEOSTR\nmy $wrapbox = GDTextWrap->new( $gd,\nlinespace  => 4,\ncolor       => $black,\ntext        => $text,\n);\n$wrapbox->setfont(gdMediumBoldFont);\n$wrapbox->setfont('arial', 12);\n$wrapbox->set(align => 'left', width => 120);\n$wrapbox->draw(10,140);\n$gd->rectangle($wrapbox->getbounds(10,140), $color);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 24,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 61,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "TODO",
                "lines": 16,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "GD::Text::Wrap - Wrap strings in boxes\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use GD;\nuse GD::Text::Wrap;\n\nmy $gd = GD::Image->new(800,600);\n# allocate colours, do other things.\n\nmy $text = <<EOSTR;\nLorem ipsum dolor sit amet, consectetuer adipiscing elit,\nsed diam nonummy nibh euismod tincidunt ut laoreet dolore\nmagna aliquam erat volutpat.\nEOSTR\n\nmy $wrapbox = GDTextWrap->new( $gd,\nlinespace  => 4,\ncolor       => $black,\ntext        => $text,\n);\n$wrapbox->setfont(gdMediumBoldFont);\n$wrapbox->setfont('arial', 12);\n$wrapbox->set(align => 'left', width => 120);\n$wrapbox->draw(10,140);\n\n$gd->rectangle($wrapbox->getbounds(10,140), $color);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "GD::Text::Wrap provides an object that draws a formatted paragraph of text in a box on a\nGD::Image canvas, using either a builtin GD font or a TrueType font.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "This class doesn't inherit from GD::Text directly, but delegates most of its work to it (in fact\nto a GD::Text::Align object. That means that most of the GD::Text::Align methods are available\nfor this class, specifically \"setfont\" and \"fontpath\". Other methods and methods with a\ndifferent interface are described here:\n\nGD::Text::Wrap->new( $gdobject, attribute => value, ... )\nCreate a new object. The first argument to new has to be a valid GD::Image object. The other\narguments will be passed to the set() method for initialisation of the attributes.\n\n$wrapbox->set( attribute => value, ... )\nset the value for an attribute. Valid attributes are:\n\nwidth\nThe width of the box to draw the text in. If unspecified, they will default to the width of\nthe GD::Image object.\n\nlinespace\nThe number of pixels between lines. Defaults to 2.\n\nparaspace, paragraphspace\nThe number of extra pixels between paragraphs, above linespace. Defaults to 0.\n\ncolor, colour\nSynonyms. The colour to use when drawing the font. Will be initialised to the last colour in\nthe GD object's palette.\n\nalign, alignment\nSynonyms. One of 'justified' (the default), 'left', 'right' or 'center'.\n\ntext\nThe text to draw. This is the only attribute that you absolutely have to set.\n\npreservenl\nIf set to a true value, newlines in the text will cause a line break. Note that lines will\nstill be justified. If only one word appears on the line, it could get ugly. Defaults to 0.\n\nAs with the methods, attributes unknown to this class get delegated to the GD::Text::Align\nclass.\n\n$wrapbox->get( attribute );\nGet the current value of an attribute. All attributes mentioned under the \"set()\" method can be\nretrieved\n\n$wrapbox->getbounds()\nReturns the bounding box of the box that will be drawn with the current attribute settings as a\nlist. The values returned are the coordinates of the upper left and lower right corner.\n\n($left, $top, $right, $bottom) = $wrapbox->getbounds();\n\nReturns an empty list on error.\n\nNOTE: The return list of this method may change in a future implementation that allows angled\nboxes.\n\n$wrapbox->draw(x, y)\nDraw the box, with (x,y) as the top right corner. Returns the same values as the \"getbounds()\"\nmethod.\n\nNOTE: The return list of this method may change in a future implementation that allows angled\nboxes.\n",
                "subsections": []
            },
            "NOTES": {
                "content": "As with all Modules for Perl: Please stick to using the interface. If you try to fiddle too much\nwith knowledge of the internals of this module, you may get burned. I may change them at any\ntime.\n\nYou can only use TrueType fonts with version of GD > 1.20, and then only if compiled with\nsupport for this. If you attempt to do it anyway, you will get errors.\n\nEven though this module lives in the GD::Text namespace, it is not a GD::Text. It does however\ndelegate a lot of its functionality to a contained object that is one (GD::Text::Align).\n",
                "subsections": []
            },
            "BUGS": {
                "content": "None that I know of, but that doesn't mean much. There may be some problems with exotic fonts,\nor locales and character encodings that I am not used to.\n",
                "subsections": []
            },
            "TODO": {
                "content": "Angled boxes.\n\nAt the moment, the only bit of the box that is allowed to be unspecified and in fact must be\nunspecified, is the bottom. If there is enough need for it, I might implement more flexibility,\nin that that you need to only specify three of the four sides of the box, and the fourth will be\ncalculated.\n\nAutomatic resizing of a TrueType font to fit inside a box when four sides are specified, or\nmaybe some other nifty things.\n\nMore flexibility in the interface. Especially draw needs some thought.\n\nMore and better error handling.\n\nWarnings for lines that are too long and stick out of the box. Warning for emptyish lines?\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "copyright 1999 Martien Verbruggen (mgjv@comdyn.com.au)\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "GD, GD::Text, GD::Text::Align\n",
                "subsections": []
            }
        }
    }
}