1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-17 21:55:07 +00:00
serenity/Libraries/LibHTML/Layout/LineBox.h
Andreas Kling eb77e680ed LibHTML: Implement "text-align: justify"
In order for this to work nicely, I made the line box classes use float
instead of int for its geometry information.

Justification works by distributing all of the whitespace on the line
(including the trailing whitespace before the line break) evenly across
the spaces in-between words.

We should probably use floating point (or maybe fixed point?) for all
the layout metrics stuff. But one thing at a time. :^)
2019-10-20 12:55:55 +02:00

20 lines
491 B
C++

#pragma once
#include <AK/Vector.h>
#include <LibHTML/Layout/LineBoxFragment.h>
class LineBox {
public:
LineBox() {}
float width() const { return m_width; }
void add_fragment(const LayoutNode& layout_node, int start, int length, int width, int height);
const Vector<LineBoxFragment>& fragments() const { return m_fragments; }
Vector<LineBoxFragment>& fragments() { return m_fragments; }
private:
Vector<LineBoxFragment> m_fragments;
float m_width { 0 };
};