Lines Matching +full:6 +full:- +full:aat +full:- +full:fonts
31 #include "hb-kern.hh"
32 #include "hb-aat-layout-ankr-table.hh"
35 * kerx -- Extended Kerning
36 * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6kerx.html
41 namespace AAT { namespace
56 if (unlikely (!c->sanitizer.check_array (pv, tupleCount))) return 0; in kerxTupleKern()
81 return_trace (c->check_struct (this)); in sanitize()
89 DEFINE_SIZE_STATIC (6);
107 if (!c->plan->requested_kerning) in apply()
115 machine.kern (c->font, c->buffer, c->plan->kern_mask); in apply()
174 { return entry->data.kernActionIndex != 0xFFFF; } in performAction()
177 { return entry->data.kernActionIndex; } in kernActionIndex()
196 { return entry->flags & Offset; } in performAction()
199 { return entry->flags & Offset; } in kernActionIndex()
223 /* Apparently the offset kernAction is from the beginning of the state-machine, in driver_context_t()
226 kernAction (&table->machine + table->kernAction), in driver_context_t()
228 crossStream (table->header.coverage & table->header.CrossStream) {} in driver_context_t()
238 hb_buffer_t *buffer = driver->buffer; in transition()
239 unsigned int flags = entry->flags; in transition()
247 stack[depth++] = buffer->idx; in transition()
254 unsigned int tuple_count = MAX (1u, table->header.tuple_count ()); in transition()
257 kern_idx = Types::byteOffsetToIndex (kern_idx, &table->machine, kernAction.arrayZ); in transition()
259 if (!c->sanitizer.check_array (actions, depth, tuple_count)) in transition()
265 hb_mask_t kern_mask = c->plan->kern_mask; in transition()
273 unsigned int idx = stack[--depth]; in transition()
276 if (idx >= buffer->len) continue; in transition()
282 hb_glyph_position_t &o = buffer->pos[idx]; in transition()
284 /* Testing shows that CoreText only applies kern (cross-stream or not) in transition()
290 if (v == -0x8000) in transition()
296 else if (HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction)) in transition()
300 if (buffer->pos[idx].attach_type() && !buffer->pos[idx].y_offset) in transition()
302 o.y_offset = c->font->em_scale_y (v); in transition()
303 buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT; in transition()
306 else if (buffer->info[idx].mask & kern_mask) in transition()
308 if (!buffer->pos[idx].x_offset) in transition()
310 buffer->pos[idx].x_advance += c->font->em_scale_x (v); in transition()
311 buffer->pos[idx].x_offset += c->font->em_scale_x (v); in transition()
320 if (buffer->pos[idx].attach_type() && !buffer->pos[idx].x_offset) in transition()
322 o.x_offset = c->font->em_scale_x (v); in transition()
323 buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT; in transition()
326 else if (buffer->info[idx].mask & kern_mask) in transition()
328 if (!buffer->pos[idx].y_offset) in transition()
330 buffer->pos[idx].y_advance += c->font->em_scale_y (v); in transition()
331 buffer->pos[idx].y_offset += c->font->em_scale_y (v); in transition()
354 if (!c->plan->requested_kerning && in apply()
360 StateTableDriver<Types, EntryData> driver (machine, c->buffer, c->font->face); in apply()
369 /* The rest of array sanitizations are done at run-time. */ in sanitize()
370 return_trace (likely (c->check_struct (this) && in sanitize()
391 unsigned int num_glyphs = c->sanitizer.get_num_glyphs (); in get_kerning()
399 if (unlikely (!v->sanitize (&c->sanitizer))) return 0; in get_kerning()
408 if (!c->plan->requested_kerning) in apply()
416 machine.kern (c->font, c->buffer, c->plan->kern_mask); in apply()
437 return_trace (likely (c->check_struct (this) && in sanitize()
440 c->check_range (this, array))); in sanitize()
448 * left-hand class table. */
451 * right-hand class table. */
485 ActionType = 0xC0000000, /* A two-bit field containing the action type. */
486 Unused = 0x3F000000, /* Unused - must be zero. */
495 action_type ((table->flags & ActionType) >> 30), in driver_context_t()
496 ankrData ((HBUINT16 *) ((const char *) &table->machine + (table->flags & Offset))), in driver_context_t()
503 return entry->data.ankrActionIndex != 0xFFFF; in is_actionable()
508 hb_buffer_t *buffer = driver->buffer; in transition()
510 if (mark_set && entry->data.ankrActionIndex != 0xFFFF && buffer->idx < buffer->len) in transition()
512 hb_glyph_position_t &o = buffer->cur_pos(); in transition()
518 const HBUINT16 *data = &ankrData[entry->data.ankrActionIndex]; in transition()
519 if (!c->sanitizer.check_array (data, 2)) in transition()
527 if (!c->font->get_glyph_contour_point_for_origin (c->buffer->info[mark].codepoint, in transition()
531 !c->font->get_glyph_contour_point_for_origin (c->buffer->cur ().codepoint, in transition()
537 o.x_offset = markX - currX; in transition()
538 o.y_offset = markY - currY; in transition()
545 const HBUINT16 *data = &ankrData[entry->data.ankrActionIndex]; in transition()
546 if (!c->sanitizer.check_array (data, 2)) in transition()
550 const Anchor markAnchor = c->ankr_table->get_anchor (c->buffer->info[mark].codepoint, in transition()
552 c->sanitizer.get_num_glyphs (), in transition()
553 c->ankr_end); in transition()
554 const Anchor currAnchor = c->ankr_table->get_anchor (c->buffer->cur ().codepoint, in transition()
556 c->sanitizer.get_num_glyphs (), in transition()
557 c->ankr_end); in transition()
559 …o.x_offset = c->font->em_scale_x (markAnchor.xCoordinate) - c->font->em_scale_x (currAnchor.xCoord… in transition()
560 …o.y_offset = c->font->em_scale_y (markAnchor.yCoordinate) - c->font->em_scale_y (currAnchor.yCoord… in transition()
566 const FWORD *data = (const FWORD *) &ankrData[entry->data.ankrActionIndex]; in transition()
567 if (!c->sanitizer.check_array (data, 4)) in transition()
574 o.x_offset = c->font->em_scale_x (markX) - c->font->em_scale_x (currX); in transition()
575 o.y_offset = c->font->em_scale_y (markY) - c->font->em_scale_y (currY); in transition()
580 o.attach_chain() = (int) mark - (int) buffer->idx; in transition()
581 buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT; in transition()
584 if (entry->flags & Mark) in transition()
587 mark = buffer->idx; in transition()
607 StateTableDriver<Types, EntryData> driver (machine, c->buffer, c->font->face); in apply()
616 /* The rest of array sanitizations are done at run-time. */ in sanitize()
617 return_trace (likely (c->check_struct (this) && in sanitize()
642 unsigned int num_glyphs = c->sanitizer.get_num_glyphs (); in get_kerning()
652 if (unlikely (!v->sanitize (&c->sanitizer))) return 0; in get_kerning()
662 if (unlikely (!v->sanitize (&c->sanitizer))) return 0; in get_kerning()
671 if (!c->plan->requested_kerning) in apply()
679 machine.kern (c->font, c->buffer, c->plan->kern_mask); in apply()
687 return_trace (likely (c->check_struct (this) && in sanitize()
692 c->check_range (this, u.l.array) in sanitize()
696 c->check_range (this, u.s.array) in sanitize()
699 c->check_range (this, vector)))); in sanitize()
751 CrossStream = 0x40000000u, /* Set if table has cross-stream kerning values. */
756 * This flag only applies to state-table based
765 return_trace (likely (c->check_struct (this))); in sanitize()
789 case 0: return_trace (c->dispatch (u.format0)); in dispatch()
790 case 1: return_trace (c->dispatch (u.format1)); in dispatch()
791 case 2: return_trace (c->dispatch (u.format2)); in dispatch()
792 case 4: return_trace (c->dispatch (u.format4)); in dispatch()
793 case 6: return_trace (c->dispatch (u.format6)); in dispatch()
794 default: return_trace (c->default_return_value ()); in dispatch()
803 !c->check_range (this, u.header.length)) in sanitize()
837 const SubTable *st = &thiz()->firstSubTable; in has_state_machine()
838 unsigned int count = thiz()->tableCount; in has_state_machine()
841 if (st->get_type () == 1) in has_state_machine()
852 const SubTable *st = &thiz()->firstSubTable; in has_cross_stream()
853 unsigned int count = thiz()->tableCount; in has_cross_stream()
856 if (st->u.header.coverage & st->u.header.CrossStream) in has_cross_stream()
868 const SubTable *st = &thiz()->firstSubTable; in get_h_kerning()
869 unsigned int count = thiz()->tableCount; in get_h_kerning()
872 if ((st->u.header.coverage & (st->u.header.Variation | st->u.header.CrossStream)) || in get_h_kerning()
873 !st->u.header.is_horizontal ()) in get_h_kerning()
875 v += st->get_kerning (left, right); in get_h_kerning()
881 bool apply (AAT::hb_aat_apply_context_t *c) const in apply()
887 c->set_lookup_index (0); in apply()
888 const SubTable *st = &thiz()->firstSubTable; in apply()
889 unsigned int count = thiz()->tableCount; in apply()
894 if (!T::Types::extended && (st->u.header.coverage & st->u.header.Variation)) in apply()
897 if (HB_DIRECTION_IS_HORIZONTAL (c->buffer->props.direction) != st->u.header.is_horizontal ()) in apply()
900 reverse = bool (st->u.header.coverage & st->u.header.Backwards) != in apply()
901 HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction); in apply()
903 …if (!c->buffer->message (c->font, "start %c%c%c%c subtable %d", HB_UNTAG (thiz()->tableTag), c->lo… in apply()
907 (st->u.header.coverage & st->u.header.CrossStream)) in apply()
911 hb_glyph_position_t *pos = c->buffer->pos; in apply()
912 unsigned int count = c->buffer->len; in apply()
916 pos[i].attach_chain() = HB_DIRECTION_IS_FORWARD (c->buffer->props.direction) ? -1 : +1; in apply()
918 * since there needs to be a non-zero attachment for post-positioning to in apply()
924 c->buffer->reverse (); in apply()
928 hb_sanitize_with_object_t with (&c->sanitizer, i < count - 1 ? st : (const SubTable *) nullptr); in apply()
929 ret |= st->dispatch (c); in apply()
933 c->buffer->reverse (); in apply()
935 …(void) c->buffer->message (c->font, "end %c%c%c%c subtable %d", HB_UNTAG (thiz()->tableTag), c->lo… in apply()
939 c->set_lookup_index (c->lookup_index + 1); in apply()
948 if (unlikely (!thiz()->version.sanitize (c) || in sanitize()
949 (unsigned) thiz()->version < (unsigned) T::minVersion || in sanitize()
950 !thiz()->tableCount.sanitize (c))) in sanitize()
955 const SubTable *st = &thiz()->firstSubTable; in sanitize()
956 unsigned int count = thiz()->tableCount; in sanitize()
959 if (unlikely (!st->u.header.sanitize (c))) in sanitize()
961 /* OpenType kern table has 2-byte subtable lengths. That's limiting. in sanitize()
963 * anyway. Certain versions of some fonts, like Calibry, contain in sanitize()
966 * have multiple subtables. To handle such fonts, we just ignore in sanitize()
968 hb_sanitize_with_object_t with (c, i < count - 1 ? st : (const SubTable *) nullptr); in sanitize()
970 if (unlikely (!st->sanitize (c))) in sanitize()
1007 } /* namespace AAT */