Romain Guy | 9f5dab3 | 2012-09-04 12:55:44 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 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 ANDROID_HWUI_FONT_UTIL_H |
| 18 | #define ANDROID_HWUI_FONT_UTIL_H |
| 19 | |
| 20 | #include <SkUtils.h> |
| 21 | |
Derek Sollenberger | 5865172 | 2014-10-20 16:26:24 -0400 | [diff] [blame] | 22 | #include "Properties.h" |
| 23 | |
Romain Guy | 9f5dab3 | 2012-09-04 12:55:44 -0700 | [diff] [blame] | 24 | /////////////////////////////////////////////////////////////////////////////// |
| 25 | // Defines |
| 26 | /////////////////////////////////////////////////////////////////////////////// |
| 27 | |
Andreas Gampe | edaecc1 | 2014-11-10 20:54:07 -0800 | [diff] [blame] | 28 | #ifdef TEXTURE_BORDER_SIZE |
| 29 | #if TEXTURE_BORDER_SIZE != 1 |
| 30 | #error TEXTURE_BORDER_SIZE other than 1 is not currently supported |
| 31 | #endif |
| 32 | #else |
| 33 | #define TEXTURE_BORDER_SIZE 1 |
Victoria Lease | 1e54681 | 2013-06-25 14:25:17 -0700 | [diff] [blame] | 34 | #endif |
Romain Guy | 9f5dab3 | 2012-09-04 12:55:44 -0700 | [diff] [blame] | 35 | |
| 36 | #define CACHE_BLOCK_ROUNDING_SIZE 4 |
| 37 | |
Chris Craik | e8c3c81 | 2016-02-05 20:10:50 -0800 | [diff] [blame] | 38 | typedef uint16_t glyph_t; |
| 39 | #define GET_METRICS(cache, glyph) cache->getGlyphIDMetrics(glyph) |
| 40 | #define IS_END_OF_STRING(glyph) false |
Romain Guy | 9f5dab3 | 2012-09-04 12:55:44 -0700 | [diff] [blame] | 41 | |
Ben Wagner | f4f18a2 | 2016-03-28 11:09:39 -0400 | [diff] [blame] | 42 | // prev, next are assumed to be signed x.6 fixed-point numbers with range |
| 43 | // [-1, 1]. Result is an integral float. |
| 44 | #define AUTO_KERN(prev, next) static_cast<float>(((next) - (prev) + 32) >> 6) |
Romain Guy | 9f5dab3 | 2012-09-04 12:55:44 -0700 | [diff] [blame] | 45 | |
| 46 | #endif // ANDROID_HWUI_FONT_UTIL_H |