42 attribute(PangoAttribute* attr,
unsigned offset_start,
unsigned offset_end)
43 :
value_(attr, &pango_attribute_destroy)
45 attr->start_index = offset_start;
46 attr->end_index = offset_end;
60 std::unique_ptr<PangoAttribute, void(*)(PangoAttribute*)>
value_;
70 pango_attr_size_new_absolute(PANGO_SCALE *
size),
71 offset_start, offset_end
75 DBG_GUI_D <<
"attribute start: " << offset_start <<
" end : " << offset_end;
83 pango_attr_weight_new(weight),
84 offset_start, offset_end
88 DBG_GUI_D <<
"attribute start: " << offset_start <<
" end : " << offset_end;
96 pango_attr_style_new(style),
97 offset_start, offset_end
101 DBG_GUI_D <<
"attribute start: " << offset_start <<
" end : " << offset_end;
109 pango_attr_underline_new(underline),
110 offset_start, offset_end
114 DBG_GUI_D <<
"attribute start: " << offset_start <<
" end : " << offset_end;
124 pango_attr_foreground_new(col_r, col_g, col_b),
125 offset_start, offset_end
129 DBG_GUI_D <<
"attribute start: " << offset_start <<
" end : " << offset_end;
130 DBG_GUI_D <<
"color: " << col_r <<
"," << col_g <<
"," << col_b;
140 pango_attr_background_new(col_r, col_g, col_b),
141 offset_start, offset_end
144 DBG_GUI_D <<
"highlight start: " << offset_start <<
"end : " << offset_end;
145 DBG_GUI_D <<
"highlight color: " << col_r <<
"," << col_g <<
"," << col_b;
147 attr.modify_in(list);
155 pango_attr_family_new(family_name.
c_str()),
156 offset_start, offset_end
160 DBG_GUI_D <<
"attribute start: " << offset_start <<
" end : " << offset_end;
161 DBG_GUI_D <<
"font family: " << family_name;
169 pango_attr_line_height_new(factor),
170 offset_start, offset_end
173 DBG_GUI_D <<
"attribute: line height (relative)";
174 DBG_GUI_D <<
"attribute start: " << offset_start <<
" end : " << offset_end;
186 PangoRectangle bounds {
194 pango_attr_shape_new_with_data(&bounds, &bounds, cairo_surface.release(),
nullptr,
nullptr),
195 offset_start, offset_end
199 DBG_GUI_D <<
"attribute start: " << offset_start <<
" end : " << offset_end;
200 DBG_GUI_D <<
"image path: " << image_path;
std::unique_ptr< PangoAttribute, void(*)(PangoAttribute *)> value_
Helper class to encapsulate the management of a PangoAttrList.
void modify(PangoAttribute *attr)
void insert(PangoAttribute *attr)
int font_scaled(int size)
const char * c_str() const
Define the common log macros for the gui toolkit.
surface_ptr create_surface(uint8_t *buffer, const point &size)
void add_attribute_image_shape(attribute_list &list, unsigned offset_start, unsigned offset_end, const std::string &image_path)
Add Pango shape attribute to a specific portion of text.
void add_attribute_size(attribute_list &list, unsigned offset_start, unsigned offset_end, int size)
Add Pango font size attribute to a specific portion of text.
void add_attribute_bg_color(attribute_list &list, unsigned offset_start, unsigned offset_end, const color_t &color)
Mark a specific portion of text for highlighting.
void add_attribute_weight(attribute_list &list, unsigned offset_start, unsigned offset_end, PangoWeight weight)
Add Pango font weight attribute to a specific portion of text.
const t_string & get_font_families(family_class fclass)
Returns the currently defined fonts.
void add_attribute_line_height(attribute_list &list, unsigned offset_start, unsigned offset_end, const double factor)
Add Pango line height attribute to a specific portion of text.
void add_attribute_underline(attribute_list &list, unsigned offset_start, unsigned offset_end, PangoUnderline underline)
Add Pango underline attribute to a specific portion of text.
void add_attribute_font_family(attribute_list &list, unsigned offset_start, unsigned offset_end, font::family_class family)
Add Pango font family attribute to a specific portion of text.
void add_attribute_style(attribute_list &list, unsigned offset_start, unsigned offset_end, PangoStyle style)
Add Pango font style attribute to a specific portion of text, used to set italic/oblique text.
void add_attribute_fg_color(attribute_list &list, unsigned offset_start, unsigned offset_end, const color_t &color)
Add Pango fg color attribute to a specific portion of text.
surface get_surface(const image::locator &i_locator, TYPE type, bool skip_cache)
Returns an image surface suitable for software manipulation.
std::size_t size(std::string_view str)
Length in characters of a UTF-8 string.
int get_pixel_scale()
Get the current active pixel scale multiplier.
void scale(size_t factor, const uint32_t *src, uint32_t *trg, int srcWidth, int srcHeight, ColorFormat colFmt, const ScalerCfg &cfg=ScalerCfg(), int yFirst=0, int yLast=std::numeric_limits< int >::max())
The basic class for representing 8-bit RGB or RGBA colour values.
constexpr std::tuple< uint16_t, uint16_t, uint16_t > to_pango_format() const
Returns the color as a triplet of 16 bit integers, a format used by Pango.