SkTextFormatParams.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright 2010 The Android Open Source Project
  3. *
  4. * Use of this source code is governed by a BSD-style license that can be
  5. * found in the LICENSE file.
  6. */
  7. #ifndef SkTextFormatParams_DEFINES
  8. #define SkTextFormatParams_DEFINES
  9. #include "include/core/SkScalar.h"
  10. #include "include/core/SkTypes.h"
  11. // Fraction of the text size to lower a strike through line below the baseline.
  12. #define kStdStrikeThru_Offset (-SK_Scalar1 * 6 / 21)
  13. // Fraction of the text size to lower a underline below the baseline.
  14. #define kStdUnderline_Offset (SK_Scalar1 / 9)
  15. // Fraction of the text size to use for a strike through or under-line.
  16. #define kStdUnderline_Thickness (SK_Scalar1 / 18)
  17. // The fraction of text size to embolden fake bold text scales with text size.
  18. // At 9 points or below, the stroke width is increased by text size / 24.
  19. // At 36 points and above, it is increased by text size / 32. In between,
  20. // it is interpolated between those values.
  21. static const SkScalar kStdFakeBoldInterpKeys[] = {
  22. SK_Scalar1*9,
  23. SK_Scalar1*36,
  24. };
  25. static const SkScalar kStdFakeBoldInterpValues[] = {
  26. SK_Scalar1/24,
  27. SK_Scalar1/32,
  28. };
  29. static_assert(SK_ARRAY_COUNT(kStdFakeBoldInterpKeys) == SK_ARRAY_COUNT(kStdFakeBoldInterpValues),
  30. "mismatched_array_size");
  31. static const int kStdFakeBoldInterpLength = SK_ARRAY_COUNT(kStdFakeBoldInterpKeys);
  32. #endif //SkTextFormatParams_DEFINES