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

/*
 * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved.
 * Copyright (C) 2006 Alexey Proskuryakov
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1.  Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 * 2.  Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 *     its contributors may be used to endorse or promote products derived
 *     from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#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/simple_font_data.h"

#include <unicode/utf16.h>

#include <algorithm>
#include <memory>
#include <utility>

#include "base/memory/ptr_util.h"
#include "base/numerics/byte_conversions.h"
#include "build/build_config.h"
#include "skia/ext/font_utils.h"
#include "third_party/blink/renderer/platform/font_family_names.h"
#include "third_party/blink/renderer/platform/fonts/font_description.h"
#include "third_party/blink/renderer/platform/fonts/opentype/open_type_baseline_metrics.h"
#include "third_party/blink/renderer/platform/fonts/opentype/open_type_vertical_data.h"
#include "third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.h"
#include "third_party/blink/renderer/platform/fonts/skia/skia_text_metrics.h"
#include "third_party/blink/renderer/platform/wtf/allocator/partitions.h"
#include "third_party/blink/renderer/platform/wtf/math_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/freetype_buildflags.h"
#include "third_party/skia/include/core/SkFont.h"
#include "third_party/skia/include/core/SkFontMetrics.h"
#include "third_party/skia/include/core/SkPath.h"
#include "third_party/skia/include/core/SkTypeface.h"
#include "third_party/skia/include/core/SkTypes.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "v8/include/v8.h"

#if !BUILDFLAG(USE_SYSTEM_FREETYPE)
#include "third_party/freetype/src/src/autofit/afws-decl.h"
#endif

namespace blink {

constexpr float kSmallCapsFontSizeMultiplier =;
constexpr float kEmphasisMarkFontSizeMultiplier =;

#if !BUILDFLAG(USE_SYSTEM_FREETYPE)
constexpr int32_t kFontObjectsMemoryConsumption =;
#else
// sizeof(AF_LatinMetricsRec) = 2128
constexpr int32_t kFontObjectsMemoryConsumption = 2128;
#endif

SimpleFontData::SimpleFontData(const FontPlatformData* platform_data,
                               const CustomFontData* custom_data,
                               bool subpixel_ascent_descent,
                               const FontMetricsOverride& metrics_override)
    :{}

SimpleFontData::~SimpleFontData() {}

void SimpleFontData::PlatformInit(bool subpixel_ascent_descent,
                                  const FontMetricsOverride& metrics_override) {}

void SimpleFontData::PlatformGlyphInit() {}

const SimpleFontData* SimpleFontData::FontDataForCharacter(UChar32) const {}

Glyph SimpleFontData::GlyphForCharacter(UChar32 codepoint) const {}

bool SimpleFontData::IsSegmented() const {}

SimpleFontData* SimpleFontData::SmallCapsFontData(
    const FontDescription& font_description) const {}

SimpleFontData* SimpleFontData::EmphasisMarkFontData(
    const FontDescription& font_description) const {}

SimpleFontData* SimpleFontData::CreateScaledFontData(
    const FontDescription& font_description,
    float scale_factor) const {}

SimpleFontData* SimpleFontData::MetricsOverriddenFontData(
    const FontMetricsOverride& metrics_override) const {}

// Internal leadings can be distributed to ascent and descent.
// -------------------------------------------
//           | - Internal Leading (in ascent)
//           |--------------------------------
//  Ascent - |              |
//           |              |
//           |              | - Em height
// ----------|--------------|
//           |              |
// Descent - |--------------------------------
//           | - Internal Leading (in descent)
// -------------------------------------------
FontHeight SimpleFontData::NormalizedTypoAscentAndDescent(
    FontBaseline baseline_type) const {}

LayoutUnit SimpleFontData::NormalizedTypoAscent(
    FontBaseline baseline_type) const {}

LayoutUnit SimpleFontData::NormalizedTypoDescent(
    FontBaseline baseline_type) const {}

static std::pair<int16_t, int16_t> TypoAscenderAndDescender(
    SkTypeface* typeface) {}

void SimpleFontData::ComputeNormalizedTypoAscentAndDescent() const {}

bool SimpleFontData::TrySetNormalizedTypoAscentAndDescent(float ascent,
                                                          float descent) const {}

LayoutUnit SimpleFontData::VerticalPosition(
    FontVerticalPositionType position_type,
    FontBaseline baseline_type) const {}

const std::optional<float>& SimpleFontData::IdeographicAdvanceWidth() const {}

const std::optional<float>& SimpleFontData::IdeographicAdvanceHeight() const {}

const std::optional<float>& SimpleFontData::IdeographicInlineSize() const {}

const HanKerning::FontData& SimpleFontData::HanKerningData(
    const LayoutLocale& locale,
    bool is_horizontal) const {}

gfx::RectF SimpleFontData::PlatformBoundsForGlyph(Glyph glyph) const {}

void SimpleFontData::BoundsForGlyphs(const Vector<Glyph, 256>& glyphs,
                                     Vector<SkRect, 256>* bounds) const {}

float SimpleFontData::WidthForGlyph(Glyph glyph) const {}

}  // namespace blink