chromium/ui/gfx/font.h

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_GFX_FONT_H_
#define UI_GFX_FONT_H_

#include <string>

#include "base/memory/scoped_refptr.h"
#include "build/build_config.h"
#include "ui/gfx/gfx_export.h"
#include "ui/gfx/native_widget_types.h"

#if BUILDFLAG(IS_APPLE)
#include <CoreText/CoreText.h>
#endif

namespace gfx {

struct FontRenderParams;
class PlatformFont;

// Font provides a wrapper around an underlying font. Copy and assignment
// operators are explicitly allowed, and cheap.
//
// Figure of font metrics:
//   +--------+-------------------+------------------+
//   |        |                   | internal leading |
//   |        | ascent (baseline) +------------------+
//   | height |                   | cap height       |
//   |        |-------------------+------------------+
//   |        | descent (height - baseline)          |
//   +--------+--------------------------------------+
class GFX_EXPORT Font {};

#ifndef NDEBUG
GFX_EXPORT std::ostream& operator<<(std::ostream& stream,
                                    const Font::Weight weight);
#endif

// Returns the Font::Weight that matches |weight| or the next bigger one.
GFX_EXPORT Font::Weight FontWeightFromInt(int weight);

}  // namespace gfx

#endif  // UI_GFX_FONT_H_