godot/scene/resources/font.cpp

/**************************************************************************/
/*  font.cpp                                                              */
/**************************************************************************/
/*                         This file is part of:                          */
/*                             GODOT ENGINE                               */
/*                        https://godotengine.org                         */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */
/*                                                                        */
/* Permission is hereby granted, free of charge, to any person obtaining  */
/* a copy of this software and associated documentation files (the        */
/* "Software"), to deal in the Software without restriction, including    */
/* without limitation the rights to use, copy, modify, merge, publish,    */
/* distribute, sublicense, and/or sell copies of the Software, and to     */
/* permit persons to whom the Software is furnished to do so, subject to  */
/* the following conditions:                                              */
/*                                                                        */
/* The above copyright notice and this permission notice shall be         */
/* included in all copies or substantial portions of the Software.        */
/*                                                                        */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
/**************************************************************************/

#include "font.h"
#include "font.compat.inc"

#include "core/io/image_loader.h"
#include "core/io/resource_loader.h"
#include "core/string/translation.h"
#include "core/templates/hash_map.h"
#include "core/templates/hashfuncs.h"
#include "scene/resources/image_texture.h"
#include "scene/resources/text_line.h"
#include "scene/resources/text_paragraph.h"
#include "scene/resources/theme.h"
#include "scene/theme/theme_db.h"

/*************************************************************************/
/*  Font                                                                 */
/*************************************************************************/

void Font::_bind_methods() {}

void Font::_update_rids_fb(const Ref<Font> &p_f, int p_depth) const {}

void Font::_update_rids() const {}

void Font::_invalidate_rids() {}

bool Font::_is_cyclic(const Ref<Font> &p_f, int p_depth) const {}

bool Font::_is_base_cyclic(const Ref<Font> &p_f, int p_depth) const {}

void Font::reset_state() {}

// Fallbacks.
void Font::set_fallbacks(const TypedArray<Font> &p_fallbacks) {}

TypedArray<Font> Font::get_fallbacks() const {}

// Output.
TypedArray<RID> Font::get_rids() const {}

// Drawing string.
real_t Font::get_height(int p_font_size) const {}

real_t Font::get_ascent(int p_font_size) const {}

real_t Font::get_descent(int p_font_size) const {}

real_t Font::get_underline_position(int p_font_size) const {}

real_t Font::get_underline_thickness(int p_font_size) const {}

String Font::get_font_name() const {}

Dictionary Font::get_ot_name_strings() const {}

String Font::get_font_style_name() const {}

BitField<TextServer::FontStyle> Font::get_font_style() const {}

int Font::get_font_weight() const {}

int Font::get_font_stretch() const {}

Dictionary Font::get_opentype_features() const {}

// Drawing string.
void Font::set_cache_capacity(int p_single_line, int p_multi_line) {}

Size2 Font::get_string_size(const String &p_text, HorizontalAlignment p_alignment, float p_width, int p_font_size, BitField<TextServer::JustificationFlag> p_jst_flags, TextServer::Direction p_direction, TextServer::Orientation p_orientation) const {}

Size2 Font::get_multiline_string_size(const String &p_text, HorizontalAlignment p_alignment, float p_width, int p_font_size, int p_max_lines, BitField<TextServer::LineBreakFlag> p_brk_flags, BitField<TextServer::JustificationFlag> p_jst_flags, TextServer::Direction p_direction, TextServer::Orientation p_orientation) const {}

void Font::draw_string(RID p_canvas_item, const Point2 &p_pos, const String &p_text, HorizontalAlignment p_alignment, float p_width, int p_font_size, const Color &p_modulate, BitField<TextServer::JustificationFlag> p_jst_flags, TextServer::Direction p_direction, TextServer::Orientation p_orientation) const {}

void Font::draw_multiline_string(RID p_canvas_item, const Point2 &p_pos, const String &p_text, HorizontalAlignment p_alignment, float p_width, int p_font_size, int p_max_lines, const Color &p_modulate, BitField<TextServer::LineBreakFlag> p_brk_flags, BitField<TextServer::JustificationFlag> p_jst_flags, TextServer::Direction p_direction, TextServer::Orientation p_orientation) const {}

void Font::draw_string_outline(RID p_canvas_item, const Point2 &p_pos, const String &p_text, HorizontalAlignment p_alignment, float p_width, int p_font_size, int p_size, const Color &p_modulate, BitField<TextServer::JustificationFlag> p_jst_flags, TextServer::Direction p_direction, TextServer::Orientation p_orientation) const {}

void Font::draw_multiline_string_outline(RID p_canvas_item, const Point2 &p_pos, const String &p_text, HorizontalAlignment p_alignment, float p_width, int p_font_size, int p_max_lines, int p_size, const Color &p_modulate, BitField<TextServer::LineBreakFlag> p_brk_flags, BitField<TextServer::JustificationFlag> p_jst_flags, TextServer::Direction p_direction, TextServer::Orientation p_orientation) const {}

// Drawing char.
Size2 Font::get_char_size(char32_t p_char, int p_font_size) const {}

real_t Font::draw_char(RID p_canvas_item, const Point2 &p_pos, char32_t p_char, int p_font_size, const Color &p_modulate) const {}

real_t Font::draw_char_outline(RID p_canvas_item, const Point2 &p_pos, char32_t p_char, int p_font_size, int p_size, const Color &p_modulate) const {}

// Helper functions.
bool Font::has_char(char32_t p_char) const {}

String Font::get_supported_chars() const {}

bool Font::is_language_supported(const String &p_language) const {}

bool Font::is_script_supported(const String &p_script) const {}

Dictionary Font::get_supported_feature_list() const {}

Dictionary Font::get_supported_variation_list() const {}

int64_t Font::get_face_count() const {}

Font::Font() {}

Font::~Font() {}

/*************************************************************************/
/*  FontFile                                                             */
/*************************************************************************/

_FORCE_INLINE_ void FontFile::_clear_cache() {}

_FORCE_INLINE_ void FontFile::_ensure_rid(int p_cache_index, int p_make_linked_from) const {}

void FontFile::_convert_packed_8bit(Ref<Image> &p_source, int p_page, int p_sz) {}

void FontFile::_convert_packed_4bit(Ref<Image> &p_source, int p_page, int p_sz) {}

void FontFile::_convert_rgba_4bit(Ref<Image> &p_source, int p_page, int p_sz) {}

void FontFile::_convert_mono_8bit(Ref<Image> &p_source, int p_page, int p_ch, int p_sz, int p_ol) {}

void FontFile::_convert_mono_4bit(Ref<Image> &p_source, int p_page, int p_ch, int p_sz, int p_ol) {}

void FontFile::_bind_methods() {}

void FontFile::_validate_property(PropertyInfo &p_property) const {}

bool FontFile::_set(const StringName &p_name, const Variant &p_value) {}

bool FontFile::_get(const StringName &p_name, Variant &r_ret) const {}

void FontFile::_get_property_list(List<PropertyInfo> *p_list) const {}

void FontFile::reset_state() {}

/*************************************************************************/

// OEM encoding mapping for 0x80..0xFF range.
static const char32_t _oem_to_unicode[][129] =;

Error FontFile::load_bitmap_font(const String &p_path) {}

Error FontFile::_load_bitmap_font(const String &p_path, List<String> *r_image_files) {}

Error FontFile::load_dynamic_font(const String &p_path) {}

void FontFile::set_data_ptr(const uint8_t *p_data, size_t p_size) {}

void FontFile::set_data(const PackedByteArray &p_data) {}

PackedByteArray FontFile::get_data() const {}

void FontFile::set_font_name(const String &p_name) {}

void FontFile::set_font_style_name(const String &p_name) {}

void FontFile::set_font_style(BitField<TextServer::FontStyle> p_style) {}

void FontFile::set_font_weight(int p_weight) {}

void FontFile::set_font_stretch(int p_stretch) {}

void FontFile::set_antialiasing(TextServer::FontAntialiasing p_antialiasing) {}

TextServer::FontAntialiasing FontFile::get_antialiasing() const {}

void FontFile::set_disable_embedded_bitmaps(bool p_disable_embedded_bitmaps) {}

bool FontFile::get_disable_embedded_bitmaps() const {}

void FontFile::set_generate_mipmaps(bool p_generate_mipmaps) {}

bool FontFile::get_generate_mipmaps() const {}

void FontFile::set_multichannel_signed_distance_field(bool p_msdf) {}

bool FontFile::is_multichannel_signed_distance_field() const {}

void FontFile::set_msdf_pixel_range(int p_msdf_pixel_range) {}

int FontFile::get_msdf_pixel_range() const {}

void FontFile::set_msdf_size(int p_msdf_size) {}

int FontFile::get_msdf_size() const {}

void FontFile::set_fixed_size(int p_fixed_size) {}

int FontFile::get_fixed_size() const {}

void FontFile::set_fixed_size_scale_mode(TextServer::FixedSizeScaleMode p_fixed_size_scale_mode) {}

TextServer::FixedSizeScaleMode FontFile::get_fixed_size_scale_mode() const {}

void FontFile::set_allow_system_fallback(bool p_allow_system_fallback) {}

bool FontFile::is_allow_system_fallback() const {}

void FontFile::set_force_autohinter(bool p_force_autohinter) {}

bool FontFile::is_force_autohinter() const {}

void FontFile::set_hinting(TextServer::Hinting p_hinting) {}

TextServer::Hinting FontFile::get_hinting() const {}

void FontFile::set_subpixel_positioning(TextServer::SubpixelPositioning p_subpixel) {}

TextServer::SubpixelPositioning FontFile::get_subpixel_positioning() const {}

void FontFile::set_oversampling(real_t p_oversampling) {}

real_t FontFile::get_oversampling() const {}

RID FontFile::find_variation(const Dictionary &p_variation_coordinates, int p_face_index, float p_strength, Transform2D p_transform, int p_spacing_top, int p_spacing_bottom, int p_spacing_space, int p_spacing_glyph, float p_baseline_offset) const {}

RID FontFile::_get_rid() const {}

int FontFile::get_cache_count() const {}

void FontFile::clear_cache() {}

void FontFile::remove_cache(int p_cache_index) {}

TypedArray<Vector2i> FontFile::get_size_cache_list(int p_cache_index) const {}

void FontFile::clear_size_cache(int p_cache_index) {}

void FontFile::remove_size_cache(int p_cache_index, const Vector2i &p_size) {}

void FontFile::set_variation_coordinates(int p_cache_index, const Dictionary &p_variation_coordinates) {}

Dictionary FontFile::get_variation_coordinates(int p_cache_index) const {}

void FontFile::set_embolden(int p_cache_index, float p_strength) {}

float FontFile::get_embolden(int p_cache_index) const {}

void FontFile::set_transform(int p_cache_index, Transform2D p_transform) {}

Transform2D FontFile::get_transform(int p_cache_index) const {}

void FontFile::set_extra_spacing(int p_cache_index, TextServer::SpacingType p_spacing, int64_t p_value) {}

int64_t FontFile::get_extra_spacing(int p_cache_index, TextServer::SpacingType p_spacing) const {}

float FontFile::get_extra_baseline_offset(int p_cache_index) const {}

void FontFile::set_extra_baseline_offset(int p_cache_index, float p_baseline_offset) {}

void FontFile::set_face_index(int p_cache_index, int64_t p_index) {}

int64_t FontFile::get_face_index(int p_cache_index) const {}

void FontFile::set_cache_ascent(int p_cache_index, int p_size, real_t p_ascent) {}

real_t FontFile::get_cache_ascent(int p_cache_index, int p_size) const {}

void FontFile::set_cache_descent(int p_cache_index, int p_size, real_t p_descent) {}

real_t FontFile::get_cache_descent(int p_cache_index, int p_size) const {}

void FontFile::set_cache_underline_position(int p_cache_index, int p_size, real_t p_underline_position) {}

real_t FontFile::get_cache_underline_position(int p_cache_index, int p_size) const {}

void FontFile::set_cache_underline_thickness(int p_cache_index, int p_size, real_t p_underline_thickness) {}

real_t FontFile::get_cache_underline_thickness(int p_cache_index, int p_size) const {}

void FontFile::set_cache_scale(int p_cache_index, int p_size, real_t p_scale) {}

real_t FontFile::get_cache_scale(int p_cache_index, int p_size) const {}

int FontFile::get_texture_count(int p_cache_index, const Vector2i &p_size) const {}

void FontFile::clear_textures(int p_cache_index, const Vector2i &p_size) {}

void FontFile::remove_texture(int p_cache_index, const Vector2i &p_size, int p_texture_index) {}

void FontFile::set_texture_image(int p_cache_index, const Vector2i &p_size, int p_texture_index, const Ref<Image> &p_image) {}

Ref<Image> FontFile::get_texture_image(int p_cache_index, const Vector2i &p_size, int p_texture_index) const {}

void FontFile::set_texture_offsets(int p_cache_index, const Vector2i &p_size, int p_texture_index, const PackedInt32Array &p_offset) {}

PackedInt32Array FontFile::get_texture_offsets(int p_cache_index, const Vector2i &p_size, int p_texture_index) const {}

PackedInt32Array FontFile::get_glyph_list(int p_cache_index, const Vector2i &p_size) const {}

void FontFile::clear_glyphs(int p_cache_index, const Vector2i &p_size) {}

void FontFile::remove_glyph(int p_cache_index, const Vector2i &p_size, int32_t p_glyph) {}

void FontFile::set_glyph_advance(int p_cache_index, int p_size, int32_t p_glyph, const Vector2 &p_advance) {}

Vector2 FontFile::get_glyph_advance(int p_cache_index, int p_size, int32_t p_glyph) const {}

void FontFile::set_glyph_offset(int p_cache_index, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_offset) {}

Vector2 FontFile::get_glyph_offset(int p_cache_index, const Vector2i &p_size, int32_t p_glyph) const {}

void FontFile::set_glyph_size(int p_cache_index, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_gl_size) {}

Vector2 FontFile::get_glyph_size(int p_cache_index, const Vector2i &p_size, int32_t p_glyph) const {}

void FontFile::set_glyph_uv_rect(int p_cache_index, const Vector2i &p_size, int32_t p_glyph, const Rect2 &p_uv_rect) {}

Rect2 FontFile::get_glyph_uv_rect(int p_cache_index, const Vector2i &p_size, int32_t p_glyph) const {}

void FontFile::set_glyph_texture_idx(int p_cache_index, const Vector2i &p_size, int32_t p_glyph, int p_texture_idx) {}

int FontFile::get_glyph_texture_idx(int p_cache_index, const Vector2i &p_size, int32_t p_glyph) const {}

TypedArray<Vector2i> FontFile::get_kerning_list(int p_cache_index, int p_size) const {}

void FontFile::clear_kerning_map(int p_cache_index, int p_size) {}

void FontFile::remove_kerning(int p_cache_index, int p_size, const Vector2i &p_glyph_pair) {}

void FontFile::set_kerning(int p_cache_index, int p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) {}

Vector2 FontFile::get_kerning(int p_cache_index, int p_size, const Vector2i &p_glyph_pair) const {}

void FontFile::render_range(int p_cache_index, const Vector2i &p_size, char32_t p_start, char32_t p_end) {}

void FontFile::render_glyph(int p_cache_index, const Vector2i &p_size, int32_t p_index) {}

void FontFile::set_language_support_override(const String &p_language, bool p_supported) {}

bool FontFile::get_language_support_override(const String &p_language) const {}

void FontFile::remove_language_support_override(const String &p_language) {}

Vector<String> FontFile::get_language_support_overrides() const {}

void FontFile::set_script_support_override(const String &p_script, bool p_supported) {}

bool FontFile::get_script_support_override(const String &p_script) const {}

void FontFile::remove_script_support_override(const String &p_script) {}

Vector<String> FontFile::get_script_support_overrides() const {}

void FontFile::set_opentype_feature_overrides(const Dictionary &p_overrides) {}

Dictionary FontFile::get_opentype_feature_overrides() const {}

int32_t FontFile::get_glyph_index(int p_size, char32_t p_char, char32_t p_variation_selector) const {}

char32_t FontFile::get_char_from_glyph_index(int p_size, int32_t p_glyph_index) const {}

FontFile::FontFile() {}

FontFile::~FontFile() {}

/*************************************************************************/
/*  FontVariation                                                        */
/*************************************************************************/

void FontVariation::_bind_methods() {}

void FontVariation::_update_rids() const {}

void FontVariation::reset_state() {}

void FontVariation::set_base_font(const Ref<Font> &p_font) {}

Ref<Font> FontVariation::get_base_font() const {}

Ref<Font> FontVariation::_get_base_font_or_default() const {}

void FontVariation::set_variation_opentype(const Dictionary &p_coords) {}

Dictionary FontVariation::get_variation_opentype() const {}

void FontVariation::set_variation_embolden(float p_strength) {}

float FontVariation::get_variation_embolden() const {}

void FontVariation::set_variation_transform(Transform2D p_transform) {}

Transform2D FontVariation::get_variation_transform() const {}

void FontVariation::set_variation_face_index(int p_face_index) {}

int FontVariation::get_variation_face_index() const {}

void FontVariation::set_opentype_features(const Dictionary &p_features) {}

Dictionary FontVariation::get_opentype_features() const {}

void FontVariation::set_spacing(TextServer::SpacingType p_spacing, int p_value) {}

int FontVariation::get_spacing(TextServer::SpacingType p_spacing) const {}

void FontVariation::set_baseline_offset(float p_baseline_offset) {}

float FontVariation::get_baseline_offset() const {}

RID FontVariation::find_variation(const Dictionary &p_variation_coordinates, int p_face_index, float p_strength, Transform2D p_transform, int p_spacing_top, int p_spacing_bottom, int p_spacing_space, int p_spacing_glyph, float p_baseline_offset) const {}

RID FontVariation::_get_rid() const {}

FontVariation::FontVariation() {}

FontVariation::~FontVariation() {}

/*************************************************************************/
/*  SystemFont                                                           */
/*************************************************************************/

void SystemFont::_bind_methods() {}

void SystemFont::_update_rids() const {}

void SystemFont::_update_base_font() {}

void SystemFont::reset_state() {}

Ref<Font> SystemFont::_get_base_font_or_default() const {}

void SystemFont::set_antialiasing(TextServer::FontAntialiasing p_antialiasing) {}

TextServer::FontAntialiasing SystemFont::get_antialiasing() const {}

void SystemFont::set_disable_embedded_bitmaps(bool p_disable_embedded_bitmaps) {}

bool SystemFont::get_disable_embedded_bitmaps() const {}

void SystemFont::set_generate_mipmaps(bool p_generate_mipmaps) {}

bool SystemFont::get_generate_mipmaps() const {}

void SystemFont::set_allow_system_fallback(bool p_allow_system_fallback) {}

bool SystemFont::is_allow_system_fallback() const {}

void SystemFont::set_force_autohinter(bool p_force_autohinter) {}

bool SystemFont::is_force_autohinter() const {}

void SystemFont::set_hinting(TextServer::Hinting p_hinting) {}

TextServer::Hinting SystemFont::get_hinting() const {}

void SystemFont::set_subpixel_positioning(TextServer::SubpixelPositioning p_subpixel) {}

TextServer::SubpixelPositioning SystemFont::get_subpixel_positioning() const {}

void SystemFont::set_multichannel_signed_distance_field(bool p_msdf) {}

bool SystemFont::is_multichannel_signed_distance_field() const {}

void SystemFont::set_msdf_pixel_range(int p_msdf_pixel_range) {}

int SystemFont::get_msdf_pixel_range() const {}

void SystemFont::set_msdf_size(int p_msdf_size) {}

int SystemFont::get_msdf_size() const {}

void SystemFont::set_oversampling(real_t p_oversampling) {}

real_t SystemFont::get_oversampling() const {}

void SystemFont::set_font_names(const PackedStringArray &p_names) {}

PackedStringArray SystemFont::get_font_names() const {}

void SystemFont::set_font_italic(bool p_italic) {}

bool SystemFont::get_font_italic() const {}

void SystemFont::set_font_weight(int p_weight) {}

int SystemFont::get_font_weight() const {}

void SystemFont::set_font_stretch(int p_stretch) {}

int SystemFont::get_font_stretch() const {}

int SystemFont::get_spacing(TextServer::SpacingType p_spacing) const {}

RID SystemFont::find_variation(const Dictionary &p_variation_coordinates, int p_face_index, float p_strength, Transform2D p_transform, int p_spacing_top, int p_spacing_bottom, int p_spacing_space, int p_spacing_glyph, float p_baseline_offset) const {}

RID SystemFont::_get_rid() const {}

int64_t SystemFont::get_face_count() const {}

SystemFont::SystemFont() {}

SystemFont::~SystemFont() {}