chromium/third_party/blink/renderer/platform/fonts/font.cc

/*
 * Copyright (C) 1999 Lars Knoll ([email protected])
 *           (C) 1999 Antti Koivisto ([email protected])
 *           (C) 2000 Dirk Mueller ([email protected])
 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved.
 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 */

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "third_party/blink/renderer/platform/fonts/font.h"

#include "cc/paint/paint_canvas.h"
#include "cc/paint/paint_flags.h"
#include "third_party/blink/renderer/platform/fonts/character_range.h"
#include "third_party/blink/renderer/platform/fonts/font_cache.h"
#include "third_party/blink/renderer/platform/fonts/font_fallback_list.h"
#include "third_party/blink/renderer/platform/fonts/font_fallback_map.h"
#include "third_party/blink/renderer/platform/fonts/shaping/caching_word_shaper.h"
#include "third_party/blink/renderer/platform/fonts/shaping/shape_result_bloberizer.h"
#include "third_party/blink/renderer/platform/fonts/shaping/shape_result_view.h"
#include "third_party/blink/renderer/platform/fonts/simple_font_data.h"
#include "third_party/blink/renderer/platform/fonts/text_fragment_paint_info.h"
#include "third_party/blink/renderer/platform/fonts/text_run_paint_info.h"
#include "third_party/blink/renderer/platform/geometry/layout_unit.h"
#include "third_party/blink/renderer/platform/text/bidi_paragraph.h"
#include "third_party/blink/renderer/platform/text/character.h"
#include "third_party/blink/renderer/platform/text/text_run.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
#include "third_party/blink/renderer/platform/wtf/text/character_names.h"
#include "third_party/blink/renderer/platform/wtf/text/unicode.h"
#include "third_party/skia/include/core/SkTextBlob.h"
#include "ui/gfx/geometry/rect_f.h"

namespace blink {

namespace {

FontFallbackList* GetOrCreateFontFallbackList(
    const FontDescription& font_description,
    FontSelector* font_selector) {}

}  // namespace

Font::Font() = default;

Font::Font(const FontDescription& fd) :{}

Font::Font(const FontDescription& font_description, FontSelector* font_selector)
    :{}

FontFallbackList* Font::EnsureFontFallbackList() const {}

bool Font::operator==(const Font& other) const {}

namespace {

void DrawBlobs(cc::PaintCanvas* canvas,
               const cc::PaintFlags& flags,
               const ShapeResultBloberizer::BlobBuffer& blobs,
               const gfx::PointF& point,
               cc::NodeId node_id = cc::kInvalidNodeId) {}

}  // anonymous ns

void Font::DrawText(cc::PaintCanvas* canvas,
                    const TextRunPaintInfo& run_info,
                    const gfx::PointF& point,
                    const cc::PaintFlags& flags,
                    DrawType draw_type) const {}

void Font::DrawText(cc::PaintCanvas* canvas,
                    const TextRunPaintInfo& run_info,
                    const gfx::PointF& point,
                    cc::NodeId node_id,
                    const cc::PaintFlags& flags,
                    DrawType draw_type) const {}

void Font::DrawText(cc::PaintCanvas* canvas,
                    const TextFragmentPaintInfo& text_info,
                    const gfx::PointF& point,
                    cc::NodeId node_id,
                    const cc::PaintFlags& flags,
                    DrawType draw_type) const {}

bool Font::DrawBidiText(cc::PaintCanvas* canvas,
                        const TextRunPaintInfo& run_info,
                        const gfx::PointF& point,
                        CustomFontNotReadyAction custom_font_not_ready_action,
                        const cc::PaintFlags& flags,
                        DrawType draw_type) const {}

void Font::DrawEmphasisMarks(cc::PaintCanvas* canvas,
                             const TextRunPaintInfo& run_info,
                             const AtomicString& mark,
                             const gfx::PointF& point,
                             const cc::PaintFlags& flags) const {}

void Font::DrawEmphasisMarks(cc::PaintCanvas* canvas,
                             const TextFragmentPaintInfo& text_info,
                             const AtomicString& mark,
                             const gfx::PointF& point,
                             const cc::PaintFlags& flags) const {}

gfx::RectF Font::TextInkBounds(const TextFragmentPaintInfo& text_info) const {}

float Font::Width(const TextRun& run, gfx::RectF* glyph_bounds) const {}

namespace {  // anonymous namespace

unsigned InterceptsFromBlobs(const ShapeResultBloberizer::BlobBuffer& blobs,
                             const SkPaint& paint,
                             const std::tuple<float, float>& bounds,
                             SkScalar* intercepts_buffer) {}

void GetTextInterceptsInternal(const ShapeResultBloberizer::BlobBuffer& blobs,
                               const cc::PaintFlags& flags,
                               const std::tuple<float, float>& bounds,
                               Vector<Font::TextIntercept>& intercepts) {}

}  // anonymous namespace

void Font::GetTextIntercepts(const TextRunPaintInfo& run_info,
                             const cc::PaintFlags& flags,
                             const std::tuple<float, float>& bounds,
                             Vector<TextIntercept>& intercepts) const {}

void Font::GetTextIntercepts(const TextFragmentPaintInfo& text_info,
                             const cc::PaintFlags& flags,
                             const std::tuple<float, float>& bounds,
                             Vector<TextIntercept>& intercepts) const {}

static inline gfx::RectF PixelSnappedSelectionRect(const gfx::RectF& rect) {}

gfx::RectF Font::SelectionRectForText(const TextRun& run,
                                      const gfx::PointF& point,
                                      float height,
                                      int from,
                                      int to) const {}

int Font::OffsetForPosition(const TextRun& run,
                            float x_float,
                            IncludePartialGlyphsOption partial_glyphs,
                            BreakGlyphsOption break_glyphs) const {}

NGShapeCache& Font::GetNGShapeCache() const {}

ShapeCache* Font::GetShapeCache() const {}

bool Font::CanShapeWordByWord() const {}

void Font::ReportNotDefGlyph() const {}

void Font::ReportEmojiSegmentGlyphCoverage(unsigned num_clusters,
                                           unsigned num_broken_clusters) const {}

void Font::WillUseFontData(const String& text) const {}

GlyphData Font::GetEmphasisMarkGlyphData(const AtomicString& mark) const {}

int Font::EmphasisMarkAscent(const AtomicString& mark) const {}

int Font::EmphasisMarkDescent(const AtomicString& mark) const {}

int Font::EmphasisMarkHeight(const AtomicString& mark) const {}

float Font::TabWidth(const SimpleFontData* font_data,
                     const TabSize& tab_size,
                     float position) const {}

LayoutUnit Font::TabWidth(const TabSize& tab_size, LayoutUnit position) const {}

bool Font::IsFallbackValid() const {}

}  // namespace blink