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)  

gsub-multi.c
Go to the documentation of this file.
1 #include "gsub-multi.h"
2 
4  Handle.dispose(&entry->from);
5  DELETE(Coverage.free, entry->to);
6 }
7 
9  .init = NULL, .copy = NULL, .dispose = deleteGsubMultiEntry};
10 
13 
15  const glyphid_t maxGlyphs, const otfcc_Options *options) {
16  subtable_gsub_multi *subtable = iSubtable_gsub_multi.create();
17  otl_Coverage *from = NULL;
18  checkLength(offset + 6);
19 
20  from = Coverage.read(data, tableLength, offset + read_16u(data + offset + 2));
21  glyphid_t seqCount = read_16u(data + offset + 4);
22  if (seqCount != from->numGlyphs) goto FAIL;
23  checkLength(offset + 6 + seqCount * 2);
24 
25  for (glyphid_t j = 0; j < seqCount; j++) {
26  uint32_t seqOffset = offset + read_16u(data + offset + 6 + j * 2);
27  otl_Coverage *cov = Coverage.create();
28  glyphid_t n = read_16u(data + seqOffset);
29  for (glyphid_t k = 0; k < n; k++) {
30  Coverage.push(cov, Handle.fromIndex(read_16u(data + seqOffset + 2 + k * 2)));
31  }
32  iSubtable_gsub_multi.push(subtable, ((otl_GsubMultiEntry){
33  .from = Handle.dup(from->glyphs[j]), .to = cov,
34  }));
35  }
36  Coverage.free(from);
37  return (otl_Subtable *)subtable;
38 
39 FAIL:
40  if (from) Coverage.free(from);
41  iSubtable_gsub_multi.free(subtable);
42  return NULL;
43 }
44 
46  const subtable_gsub_multi *subtable = &(_subtable->gsub_multi);
47  json_value *st = json_object_new(subtable->length);
48  for (glyphid_t j = 0; j < subtable->length; j++) {
49  json_object_push(st, subtable->items[j].from.name, Coverage.dump(subtable->items[j].to));
50  }
51  return st;
52 }
53 
56 
57  for (glyphid_t k = 0; k < _subtable->u.object.length; k++) {
58  json_value *_to = _subtable->u.object.values[k].value;
59  if (!_to || _to->type != json_array) continue;
62  .from = Handle.fromName(sdsnewlen(_subtable->u.object.values[k].name,
63  _subtable->u.object.values[k].name_length)),
64  .to = Coverage.parse(_to),
65  }));
66  }
67 
68  return (otl_Subtable *)st;
69 }
70 
72  const subtable_gsub_multi *subtable = &(_subtable->gsub_multi);
73  otl_Coverage *cov = Coverage.create();
74  for (glyphid_t j = 0; j < subtable->length; j++) {
75  Coverage.push(cov, Handle.dup(subtable->items[j].from));
76  }
77 
78  bk_Block *root = bk_new_Block(b16, 1, // format
79  p16, bk_newBlockFromBuffer(Coverage.build(cov)), // coverage
80  b16, subtable->length, // quantity
81  bkover);
82  for (glyphid_t j = 0; j < subtable->length; j++) {
83  bk_Block *b = bk_new_Block(b16, subtable->items[j].to->numGlyphs, bkover);
84  for (glyphid_t k = 0; k < subtable->items[j].to->numGlyphs; k++) {
85  bk_push(b, b16, subtable->items[j].to->glyphs[k].index, bkover);
86  }
87  bk_push(root, p16, b, bkover);
88  }
89  Coverage.free(cov);
90  return bk_build_Block(root);
91 }
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
#define n
Definition: t4ht.c:1290
#define b
Definition: jpegint.h:372
struct rect data
Definition: dvipdfm.c:64
json_value * json_object_push(json_value *object, const char *name, json_value *)
json_value * json_object_new(size_t length)
#define NULL
Definition: ftobjs.h:61
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
#define DELETE(fn, ptr)
Definition: otfcc-alloc.h:76
iSubtable_gsub_multi
Definition: otl.d:20761
otl_BuildHeuristics
Definition: otl.d:20979
int k
Definition: otp-parser.c:70
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_array
Definition: json.h:86
#define checkLength(offset)
Definition: common.h:13
sds sdsnewlen(const void *init, size_t initlen)
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
glyphid_t index
Definition: handle.h:20
otfcc_GlyphHandle * glyphs
Definition: coverage.h:8
glyphid_t numGlyphs
Definition: coverage.h:6
OWNING otfcc_GlyphHandle from
Definition: otl.h:55
OWNING otl_Coverage * to
Definition: otl.h:56
Definition: stemdb.c:56
otl_GsubMultiEntry * items
Definition: otl.d:20760
int j
Definition: t4ht.c:1589
json_value * otl_gsub_dump_multi(const otl_Subtable *_subtable)
Definition: gsub-multi.c:45
otl_Subtable * otl_read_gsub_multi(font_file_pointer data, uint32_t tableLength, uint32_t offset, const glyphid_t maxGlyphs, const otfcc_Options *options)
Definition: gsub-multi.c:14
caryll_Buffer * otfcc_build_gsub_multi_subtable(const otl_Subtable *_subtable, otl_BuildHeuristics heuristics)
Definition: gsub-multi.c:71
static void deleteGsubMultiEntry(otl_GsubMultiEntry *entry)
Definition: gsub-multi.c:3
otl_Subtable * otl_gsub_parse_multi(const json_value *_subtable, const otfcc_Options *options)
Definition: gsub-multi.c:54
caryll_standardVectorImpl(subtable_gsub_multi, otl_GsubMultiEntry, gsm_typeinfo, iSubtable_gsub_multi)
static caryll_ElementInterface(otl_GsubMultiEntry)
Definition: gsub-multi.c:8
subtable_gsub_multi gsub_multi
Definition: otl.h:188
#define FAIL(ec)