Ticket #58552: CGFloat@Leopard-2.patch
File CGFloat@Leopard-2.patch, 3.1 KB (added by ballapete (Peter "Pete" Dyballa), 5 years ago) |
---|
-
src/hb-coretext.
Fix on Leopard "error: implicit conversion increases floating-point precision" when building for 32-bit. https://github.com/harfbuzz/harfbuzz/issues/1740
old new 40 40 HB_BEGIN_DECLS 41 41 42 42 43 /* The macOS macro `ABS` should be equivalent, but I can't figure out 44 which header to include to get that macro. */ 45 #if CGFLOAT_IS_DOUBLE 46 #define hb_CGFloat_abs(x) fabs(x) 47 #else 48 #define hb_CGFloat_abs(x) fabsf(x) 49 #endif 50 43 51 #define HB_CORETEXT_TAG_MORT HB_TAG('m','o','r','t') 44 52 #define HB_CORETEXT_TAG_MORX HB_TAG('m','o','r','x') 45 53 #define HB_CORETEXT_TAG_KERX HB_TAG('k','e','r','x') -
src/hb-coretext.
old new 54 54 * 55 55 * https://developer.apple.com/library/content/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html 56 56 */ 57 ptem *= 96.f / 72.f;57 ptem *= ((CGFloat) 96.f) / ((CGFloat) 72.f); 58 58 return (CGFloat) (ptem <= 0.f ? HB_CORETEXT_DEFAULT_FONT_SIZE : ptem); 59 59 } 60 60 static float 61 61 coretext_font_size_to_ptem (CGFloat size) 62 62 { 63 size *= 72. / 96.;63 size *= ((CGFloat) 72.) / ((CGFloat) 96.); 64 64 return size <= 0 ? 0 : size; 65 65 } 66 66 … … 341 341 const hb_coretext_font_data_t *data = font->data.coretext; 342 342 if (unlikely (!data)) return nullptr; 343 343 344 if ( fabs (CTFontGetSize((CTFontRef) data) - coretext_font_size_from_ptem (font->ptem)) >.5)344 if (hb_CGFloat_abs (CTFontGetSize((CTFontRef) data) - coretext_font_size_from_ptem (font->ptem)) > (CGFloat) .5) 345 345 { 346 346 /* XXX-MT-bug 347 347 * Note that evaluating condition above can be dangerous if another thread … … 1018 1018 hb_glyph_info_t *info = run_info; 1019 1019 if (HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction)) 1020 1020 { 1021 hb_position_t x_offset = (positions[0].x - advances_so_far) * x_mult;1021 hb_position_t x_offset = (positions[0].x - ((CGFloat) advances_so_far)) * x_mult; 1022 1022 for (unsigned int j = 0; j < num_glyphs; j++) 1023 1023 { 1024 doubleadvance;1024 CGFloat advance; 1025 1025 if (likely (j + 1 < num_glyphs)) 1026 1026 advance = positions[j + 1].x - positions[j].x; 1027 1027 else /* last glyph */ 1028 advance = run_advance- (positions[j].x - positions[0].x);1028 advance = ((CGFloat) run_advance) - (positions[j].x - positions[0].x); 1029 1029 info->mask = advance * x_mult; 1030 1030 info->var1.i32 = x_offset; 1031 1031 info->var2.i32 = positions[j].y * y_mult; … … 1034 1034 } 1035 1035 else 1036 1036 { 1037 hb_position_t y_offset = (positions[0].y - advances_so_far) * y_mult;1037 hb_position_t y_offset = (positions[0].y - ((CGFloat) advances_so_far)) * y_mult; 1038 1038 for (unsigned int j = 0; j < num_glyphs; j++) 1039 1039 { 1040 doubleadvance;1040 CGFloat advance; 1041 1041 if (likely (j + 1 < num_glyphs)) 1042 1042 advance = positions[j + 1].y - positions[j].y; 1043 1043 else /* last glyph */ 1044 advance = run_advance- (positions[j].y - positions[0].y);1044 advance = ((CGFloat) run_advance) - (positions[j].y - positions[0].y); 1045 1045 info->mask = advance * y_mult; 1046 1046 info->var1.i32 = positions[j].x * x_mult; 1047 1047 info->var2.i32 = y_offset;