class Paragraph
    {
        private final String textContent;

        Paragraph(String text)
        {
            textContent = text;
        }

        /**
         * Get the paragraph text.
         *
         * @return the text.
         */
        String getText()
        {
            return textContent;
        }

        /**
         * Break the paragraph into individual lines.
         *
         * @param font the font used for rendering the text.
         * @param fontSize the fontSize used for rendering the text.
         * @param width the width of the box holding the content.
         * @return the individual lines.
         * @throws IOException
         */
        public List<Line> getLines(PDFont font, float fontSize, float width) throws IOException
        {<FILL_FUNCTION_BODY>}
    }

            BreakIterator iterator = BreakIterator.getLineInstance();
            iterator.setText(textContent);

            final float scale = fontSize/FONTSCALE;

            int start = iterator.first();
            int end = iterator.next();
            float lineWidth = 0;

            List<Line> textLines = new ArrayList<>();
            Line textLine = new Line();

            while (end != BreakIterator.DONE)
            {
                String word = textContent.substring(start,end);
                float wordWidth = font.getStringWidth(word) * scale;

                boolean wordNeedsSplit = false;
                int splitOffset = end - start;

                lineWidth = lineWidth + wordWidth;

                // check if the last word would fit without the whitespace ending it
                if (lineWidth >= width && Character.isWhitespace(word.charAt(word.length()-1)))
                {
                    float whitespaceWidth = font.getStringWidth(word.substring(word.length()-1)) * scale;
                    lineWidth = lineWidth - whitespaceWidth;
                }

                if (lineWidth >= width && !textLine.getWords().isEmpty())
                {
                    textLine.setWidth(textLine.calculateWidth(font, fontSize));
                    textLines.add(textLine);
                    textLine = new Line();
                    lineWidth = font.getStringWidth(word) * scale;
                }

                if (wordWidth > width && textLine.getWords().isEmpty())
                {
                    // single word does not fit into width
                    wordNeedsSplit = true;
                    while (true)
                    {
                        splitOffset--;

                        String substring = word.substring(0, splitOffset);
                        float substringWidth = font.getStringWidth(substring) * scale;
                        if (substringWidth < width)
                        {
                            word = substring;
                            wordWidth = font.getStringWidth(word) * scale;
                            lineWidth = wordWidth;
                            break;
                        }
                    }
                }

                AttributedString as = new AttributedString(word);
                as.addAttribute(TextAttribute.WIDTH, wordWidth);
                Word wordInstance = new Word(word);
                wordInstance.setAttributes(as);
                textLine.addWord(wordInstance);

                if (wordNeedsSplit)
                {
                    start = start + splitOffset;
                }
                else
                {
                    start = end;
                    end = iterator.next();
                }
            }
            textLine.setWidth(textLine.calculateWidth(font, fontSize));
            textLines.add(textLine);
            return textLines;
        
<no_super_class>