blob: 8483548bee6b2b01dc5c930aec01cbd4bfc14fae [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_SKIA_SKIA_TEXT_METRICS_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_SKIA_SKIA_TEXT_METRICS_H_
#include "third_party/blink/renderer/platform/fonts/glyph.h"
#include <SkFont.h>
#include <hb.h>
#include "third_party/blink/renderer/platform/wtf/vector.h"
class SkPaint;
namespace blink {
class SkiaTextMetrics final {
public:
SkiaTextMetrics(const SkPaint* legacy_paint);
SkiaTextMetrics(const SkFont&);
void GetGlyphWidthForHarfBuzz(hb_codepoint_t, hb_position_t* width);
void GetGlyphWidthForHarfBuzz(unsigned count,
hb_codepoint_t* first_glyph,
unsigned glyph_stride,
hb_position_t* first_advance,
unsigned advance_stride);
void GetGlyphExtentsForHarfBuzz(hb_codepoint_t, hb_glyph_extents_t*);
void GetSkiaBoundsForGlyph(Glyph, SkRect* bounds);
void GetSkiaBoundsForGlyphs(const Vector<Glyph, 256>&, SkRect*);
float GetSkiaWidthForGlyph(Glyph);
static hb_position_t SkiaScalarToHarfBuzzPosition(SkScalar value);
private:
const SkFont font_;
};
} // namespace blink
#endif