MCPcopy Create free account
hub / github.com/davisking/dlib / parse_header

Method parse_header

dlib/gui_widgets/fonts.cpp:252–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250 bool has_dw;
251 };
252 bool parse_header( header_info& info )
253 {
254 if ( required_keyword( STARTFONT ) == false )
255 return false; // parse_error: required keyword missing
256 info.has_global_dw = false;
257 int find = FONTBOUNDINGBOX | DWIDTH | DEFAULT_CHAR;
258 int stop = CHARS | STARTCHAR | ENCODING | BBX | BITMAP | ENDCHAR | ENDFONT;
259 int res;
260 while ( 1 )
261 {
262 res = find_keywords( find | stop );
263 if ( res & FONTBOUNDINGBOX )
264 {
265 in_ >> info.FBBx >> info.FBBy >> info.Xoff >> info.Yoff;
266 if ( in_.fail() )
267 return false; // parse_error
268 find &= ~FONTBOUNDINGBOX;
269 continue;
270 }
271 if ( res & DWIDTH )
272 {
273 in_ >> info.dwx0 >> info.dwy0;
274 if ( in_.fail() )
275 return false; // parse_error
276 find &= ~DWIDTH;
277 info.has_global_dw = true;
278 continue;
279 }
280 if ( res & DEFAULT_CHAR )
281 {
282 in_ >> info.default_char;
283 if ( in_.fail() )
284 return false; // parse_error
285 find &= ~DEFAULT_CHAR;
286 continue;
287 }
288 if ( res & NO_KEYWORD )
289 return false; // parse_error: unexpected EOF
290 break;
291 }
292 if ( res != CHARS || ( find & FONTBOUNDINGBOX ) )
293 return false; // parse_error: required keyword missing or unexpeced keyword
294 return true;
295 }
296 int parse_glyph( char_info& info, unichar& enc )
297 {
298 info.has_dw = false;

Callers 1

read_bdf_fileMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected