SkTextFormatParams.h revision f2b98d67dcb6fcb3120feede9c72016fc7b3ead8
1/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef SkTextFormatParams_DEFINES
18#define SkTextFormatParams_DEFINES
19
20#include "SkScalar.h"
21#include "SkTypes.h"
22
23// Fraction of the text size to lower a strike through line below the baseline.
24#define kStdStrikeThru_Offset       (-SK_Scalar1 * 6 / 21)
25// Fraction of the text size to lower a underline below the baseline.
26#define kStdUnderline_Offset        (SK_Scalar1 / 9)
27// Fraction of the text size to use for a strike through or under-line.
28#define kStdUnderline_Thickness     (SK_Scalar1 / 18)
29
30// The fraction of text size to embolden fake bold text scales with text size.
31// At 9 points or below, the stroke width is increased by text size / 24.
32// At 36 points and above, it is increased by text size / 32.  In between,
33// it is interpolated between those values.
34static const SkScalar kStdFakeBoldInterpKeys[] = {
35    SkIntToScalar(9),
36    SkIntToScalar(36)
37};
38static const SkScalar kStdFakeBoldInterpValues[] = {
39    SK_Scalar1/24,
40    SK_Scalar1/32
41};
42SK_COMPILE_ASSERT(SK_ARRAY_COUNT(kStdFakeBoldInterpKeys) ==
43                  SK_ARRAY_COUNT(kStdFakeBoldInterpValues),
44                  mismatched_array_size);
45static const int kStdFakeBoldInterpLength =
46    SK_ARRAY_COUNT(kStdFakeBoldInterpKeys);
47
48#endif  //SkTextFormatParams_DEFINES
49