mirror of
https://pdfium.googlesource.com/pdfium
synced 2026-08-02 05:04:39 +08:00
In CFX_FontMapper, replace the usage of kNumStandardFonts (cast to Index) as a sentinel value with std::optional<Index>. TAG=agy CONV=83149187-887e-49ee-8743-7f5c2b102308 Change-Id: Ia47d0b14636fe11150ac7b4921c1cf9fa22ab6ab Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/150871 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
// Copyright 2026 The PDFium Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef CORE_FXGE_CFX_STANDARDFONT_H_
|
|
#define CORE_FXGE_CFX_STANDARDFONT_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <optional>
|
|
|
|
#include "core/fxcrt/bytestring.h"
|
|
#include "core/fxcrt/span.h"
|
|
|
|
class CFX_StandardFont {
|
|
public:
|
|
enum Index : uint8_t {
|
|
kCourier = 0,
|
|
kCourierBold,
|
|
kCourierBoldOblique,
|
|
kCourierOblique,
|
|
kHelvetica,
|
|
kHelveticaBold,
|
|
kHelveticaBoldOblique,
|
|
kHelveticaOblique,
|
|
kTimes,
|
|
kTimesBold,
|
|
kTimesBoldOblique,
|
|
kTimesOblique,
|
|
kSymbol,
|
|
kDingbats,
|
|
kLast = kDingbats,
|
|
};
|
|
static constexpr int kNumStandardFonts = 14;
|
|
|
|
static std::optional<Index> GetStandardFontIndex(const ByteString& name);
|
|
static ByteString GetCanonicalFontName(Index font);
|
|
|
|
static bool IsStandardFontName(const ByteString& name);
|
|
static bool IsSymbolicFont(Index font);
|
|
static bool IsFixedFont(Index font);
|
|
|
|
static pdfium::span<const uint8_t> GetFontData(Index font);
|
|
static pdfium::span<const uint8_t> GetGenericSansFontData();
|
|
static pdfium::span<const uint8_t> GetGenericSerifFontData();
|
|
};
|
|
|
|
#endif // CORE_FXGE_CFX_STANDARDFONT_H_
|