HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Data Structures | Namespaces | Typedefs | Functions
unicode_line_break.hpp File Reference
#include "unicode_break_opportunity.hpp"
#include "ucd_general_categories.hpp"
#include "ucd_grapheme_cluster_breaks.hpp"
#include "ucd_line_break_classes.hpp"
#include "ucd_east_asian_widths.hpp"
#include "../utility/utility.hpp"
#include "../macros.hpp"
#include <cstdint>
#include <vector>
#include <algorithm>
#include <numeric>

Go to the source code of this file.

Data Structures

struct  v1::detail::unicode_line_break_info
 Combined unicode_line_break_class and unicode_line_break_opportunity. More...
 

Namespaces

namespace  v1
 DOXYGEN BUG.
 

Typedefs

using v1::detail::unicode_line_break_info_vector = std::vector<unicode_line_break_info>
 
using v1::detail::unicode_line_break_info_iterator = unicode_line_break_info_vector::iterator
 
using v1::detail::unicode_line_break_info_const_iterator = unicode_line_break_info_vector::const_iterator
 

Functions

 hi_export_module (hikogui.unicode.unicode_line_break)
 
template<typename It , typename ItEnd , typename CodePointFunc >
constexpr std::vector< unicode_line_break_infov1::detail::unicode_LB1 (It first, ItEnd last, CodePointFunc const &code_point_func) noexcept
 
constexpr void v1::detail::unicode_LB2_3 (unicode_break_vector &opportunities) noexcept
 
template<typename MatchFunc >
constexpr void v1::detail::unicode_LB_walk (unicode_break_vector &opportunities, std::vector< unicode_line_break_info > const &infos, MatchFunc match_func) noexcept
 
constexpr void v1::detail::unicode_LB4_8a (unicode_break_vector &opportunities, std::vector< unicode_line_break_info > const &infos) noexcept
 
constexpr void v1::detail::unicode_LB9 (unicode_break_vector &opportunities, std::vector< unicode_line_break_info > &infos) noexcept
 
constexpr void v1::detail::unicode_LB10 (std::vector< unicode_line_break_info > &infos) noexcept
 
constexpr void v1::detail::unicode_LB11_31 (unicode_break_vector &opportunities, std::vector< unicode_line_break_info > const &infos) noexcept
 
constexpr float v1::detail::unicode_LB_width (std::vector< float >::const_iterator first, std::vector< float >::const_iterator last) noexcept
 Calculate the width of a line.
 
constexpr float v1::detail::unicode_LB_width (std::vector< float > const &widths, std::vector< size_t > const &lengths)
 Get the width of the entire text.
 
constexpr bool v1::detail::unicode_LB_width_check (std::vector< float > const &widths, std::vector< size_t > const &lengths, float maximum_line_width) noexcept
 Check if all the lines in the text fit the maximum width.
 
constexpr std::vector< size_t > v1::detail::unicode_LB_mandatory_lines (unicode_break_vector const &opportunities) noexcept
 Get the length of each line when broken with mandatory breaks.
 
constexpr std::vector< size_t > v1::detail::unicode_LB_optional_lines (unicode_break_vector const &opportunities) noexcept
 Get the length of each line when broken with mandatory and optional breaks.
 
constexpr unicode_break_const_iterator v1::detail::unicode_LB_fast_fit_line (unicode_break_const_iterator opportunity_it, std::vector< float >::const_iterator width_it, float maximum_line_width) noexcept
 
constexpr unicode_break_const_iterator v1::detail::unicode_LB_slow_fit_line (unicode_break_const_iterator first, unicode_break_const_iterator end_of_line, std::vector< float >::const_iterator first_width, float maximum_line_width) noexcept
 
constexpr unicode_break_const_iterator v1::detail::unicode_LB_finish_fit_line (unicode_break_const_iterator first, unicode_break_const_iterator end_of_line) noexcept
 
constexpr std::vector< size_t > v1::detail::unicode_LB_fit_lines (unicode_break_vector const &opportunities, std::vector< float > const &widths, float maximum_line_width) noexcept
 Get the length of each line when broken after folding text to a maximum width.
 
constexpr std::pair< float, std::vector< size_t > > v1::detail::unicode_LB_maximum_width (unicode_break_vector const &opportunities, std::vector< float > const &char_widths)
 Get the maximum width of the text.
 
constexpr std::pair< float, std::vector< size_t > > v1::detail::unicode_LB_minimum_width (unicode_break_vector const &opportunities, std::vector< float > const &char_widths)
 Get the minimum width of the text.
 
constexpr std::pair< float, std::vector< size_t > > v1::detail::unicode_LB_width (unicode_break_vector const &opportunities, std::vector< float > const &char_widths, float maximum_line_width)
 Get the width of the text at a maximum width.
 
template<typename It , typename ItEnd , typename CodePointFunc >
unicode_break_vector v1::unicode_line_break (It first, ItEnd last, CodePointFunc const &code_point_func) noexcept
 The unicode line break algorithm UAX #14.
 
constexpr std::vector< size_t > v1::unicode_line_break (unicode_break_vector const &opportunities, std::vector< float > const &widths, float maximum_line_width)
 Unicode break lines.
 

Function Documentation

◆ unicode_LB_fit_lines()

constexpr std::vector< size_t > v1::detail::unicode_LB_fit_lines ( unicode_break_vector const & opportunities,
std::vector< float > const & widths,
float maximum_line_width )
constexprnoexcept

Get the length of each line when broken after folding text to a maximum width.

Returns
A list of line lengths.

◆ unicode_LB_mandatory_lines()

constexpr std::vector< size_t > v1::detail::unicode_LB_mandatory_lines ( unicode_break_vector const & opportunities)
constexprnoexcept

Get the length of each line when broken with mandatory breaks.

Returns
A list of line lengths.

◆ unicode_LB_maximum_width()

constexpr std::pair< float, std::vector< size_t > > v1::detail::unicode_LB_maximum_width ( unicode_break_vector const & opportunities,
std::vector< float > const & char_widths )
constexpr

Get the maximum width of the text.

The width of the text when using only the mandatory break-opportunity.

Parameters
opportunitiesThe break-opportunity per character.
char_widthsThe width of each character.
Returns
The maximum line width of the text, number of lines.

◆ unicode_LB_minimum_width()

constexpr std::pair< float, std::vector< size_t > > v1::detail::unicode_LB_minimum_width ( unicode_break_vector const & opportunities,
std::vector< float > const & char_widths )
constexpr

Get the minimum width of the text.

The width of the text when using each and every break-opportunity.

Parameters
opportunitiesThe break-opportunity per character.
char_widthsThe width of each character.
Returns
The minimum line width of the text, number of lines.

◆ unicode_LB_optional_lines()

constexpr std::vector< size_t > v1::detail::unicode_LB_optional_lines ( unicode_break_vector const & opportunities)
constexprnoexcept

Get the length of each line when broken with mandatory and optional breaks.

Returns
A list of line lengths.

◆ unicode_LB_width() [1/3]

constexpr float v1::detail::unicode_LB_width ( std::vector< float > const & widths,
std::vector< size_t > const & lengths )
constexpr

Get the width of the entire text.

Parameters
widthsWidth of each character in the text.
lengthsNumber of characters on each line.
Returns
The maximum line width.

◆ unicode_LB_width() [2/3]

constexpr float v1::detail::unicode_LB_width ( std::vector< float >::const_iterator first,
std::vector< float >::const_iterator last )
constexprnoexcept

Calculate the width of a line.

Parameters
firstIterator to the first character widths.
lastIterator to one beyond the last character width.
Returns
The length of the line.

◆ unicode_LB_width() [3/3]

constexpr std::pair< float, std::vector< size_t > > v1::detail::unicode_LB_width ( unicode_break_vector const & opportunities,
std::vector< float > const & char_widths,
float maximum_line_width )
constexpr

Get the width of the text at a maximum width.

The width of the text when folding the text to a maximum width.

Parameters
opportunitiesThe break-opportunity per character.
char_widthsThe width of each character.
maximum_line_widthThe maximum width of the text
Returns
The minimum line width of the folded text, number of lines.

◆ unicode_LB_width_check()

constexpr bool v1::detail::unicode_LB_width_check ( std::vector< float > const & widths,
std::vector< size_t > const & lengths,
float maximum_line_width )
constexprnoexcept

Check if all the lines in the text fit the maximum width.

Parameters
widthsWidth of each character in the text.
lengthsNumber of characters on each line.
maximum_line_widthThe maximum line width allowed.
Returns
True if all the lines fit the maximum width.