chromium/third_party/skia/src/ports/SkFontConfigInterface_direct.cpp

/*
 * Copyright 2009-2015 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */

#include "include/core/SkFontStyle.h"
#include "include/core/SkStream.h"
#include "include/core/SkString.h"
#include "include/core/SkTypeface.h"
#include "include/private/base/SkFixed.h"
#include "include/private/base/SkMutex.h"
#include "include/private/base/SkTArray.h"
#include "include/private/base/SkTDArray.h"
#include "include/private/base/SkTemplates.h"
#include "src/base/SkAutoMalloc.h"
#include "src/base/SkBuffer.h"
#include "src/ports/SkFontConfigInterface_direct.h"

#include <fontconfig/fontconfig.h>
#include <unistd.h>

namespace {

// FontConfig was thread antagonistic until 2.10.91 with known thread safety issues until 2.13.93.
// Before that, lock with a global mutex.
// See https://bug.skia.org/1497 and cl/339089311 for background.
static SkMutex& f_c_mutex() {}

struct FCLocker {};

UniqueFCConfig;

} // namespace

size_t SkFontConfigInterface::FontIdentity::writeToMemory(void* addr) const {}

size_t SkFontConfigInterface::FontIdentity::readFromMemory(const void* addr,
                                                           size_t size) {}

#ifdef SK_DEBUG
static void make_iden(SkFontConfigInterface::FontIdentity* iden) {}

static void test_writeToMemory(const SkFontConfigInterface::FontIdentity& iden0,
                               int initValue) {}

static void fontconfiginterface_unittest() {}
#endif

///////////////////////////////////////////////////////////////////////////////

// Returns the string from the pattern, or nullptr
static const char* get_string(FcPattern* pattern, const char field[], int index = 0) {}

///////////////////////////////////////////////////////////////////////////////

namespace {

// Equivalence classes, used to match the Liberation and other fonts
// with their metric-compatible replacements.  See the discussion in
// GetFontEquivClass().
enum FontEquivClass
{};

// Match the font name against a whilelist of fonts, returning the equivalence
// class.
FontEquivClass GetFontEquivClass(const char* fontname)
{}


// Return true if |font_a| and |font_b| are visually and at the metrics
// level interchangeable.
bool IsMetricCompatibleReplacement(const char* font_a, const char* font_b)
{}

// Normally we only return exactly the font asked for. In last-resort
// cases, the request either doesn't specify a font or is one of the
// basic font names like "Sans", "Serif" or "Monospace". This function
// tells you whether a given request is for such a fallback.
bool IsFallbackFontAllowed(const SkString& family) {}

// Retrieves |is_bold|, |is_italic| and |font_family| properties from |font|.
static int get_int(FcPattern* pattern, const char object[], int missing) {}

static int map_range(SkScalar value,
                     SkScalar old_min, SkScalar old_max,
                     SkScalar new_min, SkScalar new_max)
{}

struct MapRanges {};

static SkScalar map_ranges(SkScalar val, MapRanges const ranges[], int rangesCount) {}

#ifndef FC_WEIGHT_DEMILIGHT
#define FC_WEIGHT_DEMILIGHT
#endif

static SkFontStyle skfontstyle_from_fcpattern(FcPattern* pattern) {}

static void fcpattern_from_skfontstyle(SkFontStyle style, FcPattern* pattern) {}

}  // anonymous namespace

///////////////////////////////////////////////////////////////////////////////

#define kMaxFontFamilyLength
#ifdef SK_FONT_CONFIG_INTERFACE_ONLY_ALLOW_SFNT_FONTS
const char* kFontFormatTrueType =;
const char* kFontFormatCFF =;
#endif

SkFontConfigInterfaceDirect::SkFontConfigInterfaceDirect(FcConfig* fc) :{}

SkFontConfigInterfaceDirect::~SkFontConfigInterfaceDirect() {}

bool SkFontConfigInterfaceDirect::isAccessible(const char* filename) {}

bool SkFontConfigInterfaceDirect::isValidPattern(FcPattern* pattern) {}

// Find matching font from |font_set| for the given font family.
FcPattern* SkFontConfigInterfaceDirect::MatchFont(FcFontSet* font_set,
                                                  const char* post_config_family,
                                                  const SkString& family) {}

bool SkFontConfigInterfaceDirect::matchFamilyName(const char familyName[],
                                                  SkFontStyle style,
                                                  FontIdentity* outIdentity,
                                                  SkString* outFamilyName,
                                                  SkFontStyle* outStyle) {}

SkStreamAsset* SkFontConfigInterfaceDirect::openStream(const FontIdentity& identity) {}