w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

gpos-cursive.c
Go to the documentation of this file.
1 #include "gpos-cursive.h"
2 #include "gpos-common.h"
3 
5  Handle.dispose(&entry->target);
6 }
7 
9  .init = NULL, .copy = NULL, .dispose = deleteGposCursiveEntry};
10 
13 
15  uint32_t offset, const glyphid_t maxGlyphs,
16  const otfcc_Options *options) {
17  subtable_gpos_cursive *subtable = iSubtable_gpos_cursive.create();
18  otl_Coverage *targets = NULL;
19 
20  checkLength(offset + 6);
21 
22  targets = Coverage.read(data, tableLength, offset + read_16u(data + offset + 2));
23  if (!targets || targets->numGlyphs == 0) goto FAIL;
24 
25  glyphid_t valueCount = read_16u(data + offset + 4);
26  checkLength(offset + 6 + 4 * valueCount);
27  if (valueCount != targets->numGlyphs) goto FAIL;
28 
29  for (glyphid_t j = 0; j < valueCount; j++) {
30  uint16_t enterOffset = read_16u(data + offset + 6 + 4 * j);
31  uint16_t exitOffset = read_16u(data + offset + 6 + 4 * j + 2);
32  otl_Anchor enter = otl_anchor_absent();
34  if (enterOffset) { enter = otl_read_anchor(data, tableLength, offset + enterOffset); }
35  if (exitOffset) { exit = otl_read_anchor(data, tableLength, offset + exitOffset); }
37  subtable, ((otl_GposCursiveEntry){
38  .target = Handle.dup(targets->glyphs[j]), .enter = enter, .exit = exit}));
39  }
40  if (targets) Coverage.free(targets);
41  return (otl_Subtable *)subtable;
42 FAIL:
43  if (targets) Coverage.free(targets);
44  iSubtable_gpos_cursive.free(subtable);
45  return NULL;
46 }
47 
49  const subtable_gpos_cursive *subtable = &(_subtable->gpos_cursive);
50  json_value *st = json_object_new(subtable->length);
51  for (glyphid_t j = 0; j < subtable->length; j++) {
52  json_value *rec = json_object_new(2);
53  json_object_push(rec, "enter", otl_dump_anchor(subtable->items[j].enter));
54  json_object_push(rec, "exit", otl_dump_anchor(subtable->items[j].exit));
55  json_object_push(st, subtable->items[j].target.name, preserialize(rec));
56  }
57  return st;
58 }
59 
61  subtable_gpos_cursive *subtable = iSubtable_gpos_cursive.create();
62  for (glyphid_t j = 0; j < _subtable->u.object.length; j++) {
63  if (_subtable->u.object.values[j].value &&
64  _subtable->u.object.values[j].value->type == json_object) {
65  sds gname = sdsnewlen(_subtable->u.object.values[j].name,
66  _subtable->u.object.values[j].name_length);
68  subtable, ((otl_GposCursiveEntry){
69  .target = Handle.fromName(gname),
70  .enter = otl_parse_anchor(
71  json_obj_get(_subtable->u.object.values[j].value, "enter")),
72  .exit = otl_parse_anchor(
73  json_obj_get(_subtable->u.object.values[j].value, "exit")),
74  }));
75  }
76  }
77  return (otl_Subtable *)subtable;
78 }
79 
81  otl_BuildHeuristics heuristics) {
82  const subtable_gpos_cursive *subtable = &(_subtable->gpos_cursive);
83  otl_Coverage *cov = Coverage.create();
84  for (glyphid_t j = 0; j < subtable->length; j++) {
85  Coverage.push(cov, Handle.dup(subtable->items[j].target));
86  }
87 
88  bk_Block *root = bk_new_Block(b16, 1, // format
89  p16, bk_newBlockFromBuffer(Coverage.build(cov)), // Coverage
90  b16, subtable->length, // EntryExitCount
91  bkover);
92  for (glyphid_t j = 0; j < subtable->length; j++) {
93  bk_push(root, // EntryExitRecord[.]
94  p16, bkFromAnchor(subtable->items[j].enter), // enter
95  p16, bkFromAnchor(subtable->items[j].exit), // exit
96  bkover);
97  }
98  Coverage.free(cov);
99 
100  return bk_build_Block(root);
101 }
static uint16_t read_16u(const uint8_t *src)
Definition: bin-io.h:121
bk_Block * bk_newBlockFromBuffer(MOVE caryll_Buffer *buf)
Definition: bkblock.c:98
bk_Block * bk_new_Block(int type0,...)
Definition: bkblock.c:72
bk_Block * bk_push(bk_Block *b, int type0,...)
Definition: bkblock.c:81
@ b16
Definition: bkblock.h:17
@ p16
Definition: bkblock.h:19
@ bkover
Definition: bkblock.h:15
caryll_Buffer * bk_build_Block(bk_Block *root)
Definition: bkgraph.c:396
struct rect data
Definition: dvipdfm.c:64
bk_Block * bkFromAnchor(otl_Anchor a)
Definition: gpos-common.c:134
otl_Anchor otl_parse_anchor(json_value *v)
Definition: gpos-common.c:125
json_value * otl_dump_anchor(otl_Anchor a)
Definition: gpos-common.c:115
otl_Anchor otl_read_anchor(font_file_pointer data, uint32_t tableLength, uint32_t offset)
Definition: gpos-common.c:102
otl_Anchor otl_anchor_absent()
Definition: gpos-common.c:98
json_value * json_object_push(json_value *object, const char *name, json_value *)
json_value * json_object_new(size_t length)
static json_value * preserialize(MOVE json_value *x)
Definition: json-funcs.h:187
static json_value * json_obj_get(const json_value *obj, const char *key)
Definition: json-funcs.h:26
#define NULL
Definition: ftobjs.h:61
void exit()
unsigned short uint16_t
Definition: stdint.h:79
unsigned int uint32_t
Definition: stdint.h:80
pdf_obj * entry
Definition: pdfdoc.c:64
#define root
Definition: ctangleboot.c:69
#define Handle
Definition: aliases.h:45
uint8_t * font_file_pointer
Definition: aliases.h:41
#define Coverage
Definition: aliases.h:58
otl_BuildHeuristics
Definition: otl.d:20979
iSubtable_gpos_cursive
Definition: otl.d:20843
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst st
static int offset
Definition: ppmtogif.c:642
uint16_t glyphid_t
Definition: primitives.h:14
@ json_object
Definition: json.h:85
#define checkLength(offset)
Definition: common.h:13
sds sdsnewlen(const void *init, size_t initlen)
char * sds
Definition: sds.h:41
unsigned int name_length
Definition: json.h:103
char * name
Definition: json.h:102
struct _json_value * value
Definition: json.h:105
json_type type
Definition: json.h:113
unsigned int length
Definition: json.h:123
struct _json_value::@1795::@1798 object
json_object_entry * values
Definition: json.h:132
union _json_value::@1795 u
OWNING sds name
Definition: handle.h:21
otfcc_GlyphHandle * glyphs
Definition: coverage.h:8
glyphid_t numGlyphs
Definition: coverage.h:6
OWNING otl_Anchor enter
Definition: otl.h:137
OWNING otfcc_GlyphHandle target
Definition: otl.h:136
OWNING otl_Anchor exit
Definition: otl.h:138
Definition: stemdb.c:56
otl_GposCursiveEntry * items
Definition: otl.d:20842
int j
Definition: t4ht.c:1589
otl_Subtable * otl_read_gpos_cursive(const font_file_pointer data, uint32_t tableLength, uint32_t offset, const glyphid_t maxGlyphs, const otfcc_Options *options)
Definition: gpos-cursive.c:14
caryll_Buffer * otfcc_build_gpos_cursive(const otl_Subtable *_subtable, otl_BuildHeuristics heuristics)
Definition: gpos-cursive.c:80
static caryll_ElementInterface(otl_GposCursiveEntry)
Definition: gpos-cursive.c:8
caryll_standardVectorImpl(subtable_gpos_cursive, otl_GposCursiveEntry, gss_typeinfo, iSubtable_gpos_cursive)
otl_Subtable * otl_gpos_parse_cursive(const json_value *_subtable, const otfcc_Options *options)
Definition: gpos-cursive.c:60
json_value * otl_gpos_dump_cursive(const otl_Subtable *_subtable)
Definition: gpos-cursive.c:48
static void deleteGposCursiveEntry(otl_GposCursiveEntry *entry)
Definition: gpos-cursive.c:4
subtable_gpos_cursive gpos_cursive
Definition: otl.h:194
#define FAIL(ec)