Changeset d53af3c8 in mainline for uspace/lib/gfxfont/src/typeface.c
- Timestamp:
- 2020-09-18T23:00:44Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0ee3157
- Parents:
- 7bef2d8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/gfxfont/src/typeface.c
r7bef2d8 rd53af3c8 41 41 #include <gfx/typeface.h> 42 42 #include <mem.h> 43 #include <riff/chunk.h> 43 44 #include <stdlib.h> 44 45 #include "../private/font.h" 45 46 #include "../private/glyph.h" 47 #include "../private/tpf_file.h" 46 48 #include "../private/typeface.h" 47 49 … … 111 113 } 112 114 115 /** Save typeface into a TPF file. 116 * 117 * @param tface Typeface 118 * @param fname Destination file name 119 * @return EOK on success or an error code 120 */ 121 errno_t gfx_typeface_save(gfx_typeface_t *tface, const char *fname) 122 { 123 riffw_t *riffw = NULL; 124 errno_t rc; 125 gfx_font_info_t *finfo; 126 riff_wchunk_t riffck; 127 128 rc = riff_wopen(fname, &riffw); 129 if (rc != EOK) 130 return rc; 131 132 rc = riff_wchunk_start(riffw, CKID_RIFF, &riffck); 133 if (rc != EOK) 134 goto error; 135 136 rc = riff_write_uint32(riffw, FORM_TPFC); 137 if (rc != EOK) 138 goto error; 139 140 finfo = gfx_typeface_first_font(tface); 141 while (finfo != NULL) { 142 /* Save font */ 143 rc = gfx_font_save(finfo, riffw); 144 if (rc != EOK) 145 goto error; 146 147 finfo = gfx_typeface_next_font(finfo); 148 } 149 150 rc = riff_wchunk_end(riffw, &riffck); 151 if (rc != EOK) 152 goto error; 153 154 rc = riff_wclose(riffw); 155 if (rc != EOK) 156 return rc; 157 158 return EOK; 159 error: 160 if (riffw != NULL) 161 riff_wclose(riffw); 162 return rc; 163 } 164 113 165 /** @} 114 166 */
Note:
See TracChangeset
for help on using the changeset viewer.