104
104
(container->blips == NULL || container->blips->len == 0))
105
105
return ms_container_get_blip (container->parent, blip_id);
107
g_return_val_if_fail (container->blips != NULL, NULL);
107
108
g_return_val_if_fail (blip_id < (int)container->blips->len, NULL);
109
110
return g_ptr_array_index (container->blips, blip_id);
252
253
pango_attr_list_change (run->accum, dst);
256
258
ms_container_read_markup (MSContainer const *c,
257
guint8 const *data, int txo_len, char const *str)
259
guint8 const *data, size_t txo_len,
261
g_return_val_if_fail (txo_len >= 16, NULL); /* min two records */
265
XL_CHECK_CONDITION_VAL (txo_len >= 16,
266
pango_attr_list_new ()); /* min two records */
268
str_len = g_utf8_strlen (str, -1);
263
270
txo_run.last = G_MAXINT;
264
271
txo_run.accum = pango_attr_list_new ();
265
for (txo_len -= 16 ; txo_len >= 0 ; txo_len -= 8) {
266
txo_run.first = g_utf8_offset_to_pointer (str,
267
GSF_LE_GET_GUINT16 (data + txo_len)) - str;
268
pango_attr_list_filter (ms_container_get_markup (
269
c, GSF_LE_GET_GUINT16 (data + txo_len + 2)),
270
(PangoAttrFilterFunc) append_txorun, &txo_run);
272
for (txo_len -= 16 ; (gssize)txo_len >= 0 ; txo_len -= 8) {
273
guint16 o = GSF_LE_GET_GUINT16 (data + txo_len);
274
guint16 idx = GSF_LE_GET_GUINT16 (data + txo_len + 2);
276
txo_run.first = g_utf8_offset_to_pointer (str, o) - str;
277
XL_CHECK_CONDITION_VAL (txo_run.first < txo_run.last, txo_run.accum);
279
pango_attr_list_filter (ms_container_get_markup (c, idx),
280
(PangoAttrFilterFunc) append_txorun,
271
282
txo_run.last = txo_run.first;
273
284
return txo_run.accum;