blob: f41c4de1d54503dde336869f2663d3a9f1024399 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
vandebo@chromium.org28be72b2010-11-11 21:37:00 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2010 The Android Open Source Project
vandebo@chromium.org28be72b2010-11-11 21:37:00 +00004 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00005 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
vandebo@chromium.org28be72b2010-11-11 21:37:00 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
vandebo@chromium.org28be72b2010-11-11 21:37:00 +000010#ifndef SkTextFormatParams_DEFINES
11#define SkTextFormatParams_DEFINES
12
13#include "SkScalar.h"
14#include "SkTypes.h"
15
16// Fraction of the text size to lower a strike through line below the baseline.
17#define kStdStrikeThru_Offset (-SK_Scalar1 * 6 / 21)
18// Fraction of the text size to lower a underline below the baseline.
19#define kStdUnderline_Offset (SK_Scalar1 / 9)
20// Fraction of the text size to use for a strike through or under-line.
21#define kStdUnderline_Thickness (SK_Scalar1 / 18)
22
23// The fraction of text size to embolden fake bold text scales with text size.
24// At 9 points or below, the stroke width is increased by text size / 24.
25// At 36 points and above, it is increased by text size / 32. In between,
26// it is interpolated between those values.
27static const SkScalar kStdFakeBoldInterpKeys[] = {
digit@google.comc2c80c42012-02-16 22:06:51 +000028 SK_Scalar1*9,
29 SK_Scalar1*36,
vandebo@chromium.org28be72b2010-11-11 21:37:00 +000030};
31static const SkScalar kStdFakeBoldInterpValues[] = {
32 SK_Scalar1/24,
bungeman99fe8222015-08-20 07:57:51 -070033 SK_Scalar1/32,
vandebo@chromium.org28be72b2010-11-11 21:37:00 +000034};
bungeman99fe8222015-08-20 07:57:51 -070035static_assert(SK_ARRAY_COUNT(kStdFakeBoldInterpKeys) == SK_ARRAY_COUNT(kStdFakeBoldInterpValues),
36 "mismatched_array_size");
37static const int kStdFakeBoldInterpLength = SK_ARRAY_COUNT(kStdFakeBoldInterpKeys);
vandebo@chromium.org28be72b2010-11-11 21:37:00 +000038
39#endif //SkTextFormatParams_DEFINES