epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame^] | 1 | |
vandebo@chromium.org | 28be72b | 2010-11-11 21:37:00 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame^] | 3 | * Copyright 2010 The Android Open Source Project |
vandebo@chromium.org | 28be72b | 2010-11-11 21:37:00 +0000 | [diff] [blame] | 4 | * |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame^] | 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
vandebo@chromium.org | 28be72b | 2010-11-11 21:37:00 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame^] | 9 | |
vandebo@chromium.org | 28be72b | 2010-11-11 21:37:00 +0000 | [diff] [blame] | 10 | #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. |
| 27 | static const SkScalar kStdFakeBoldInterpKeys[] = { |
| 28 | SkIntToScalar(9), |
| 29 | SkIntToScalar(36) |
| 30 | }; |
| 31 | static const SkScalar kStdFakeBoldInterpValues[] = { |
| 32 | SK_Scalar1/24, |
| 33 | SK_Scalar1/32 |
| 34 | }; |
| 35 | SK_COMPILE_ASSERT(SK_ARRAY_COUNT(kStdFakeBoldInterpKeys) == |
| 36 | SK_ARRAY_COUNT(kStdFakeBoldInterpValues), |
| 37 | mismatched_array_size); |
| 38 | static const int kStdFakeBoldInterpLength = |
| 39 | SK_ARRAY_COUNT(kStdFakeBoldInterpKeys); |
| 40 | |
| 41 | #endif //SkTextFormatParams_DEFINES |