![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/share/emscripten/tests/poppler/poppler/ |
Upload File : |
//======================================================================== // // BuiltinFont.cc // // Copyright 2001-2003 Glyph & Cog, LLC // //======================================================================== #include <config.h> #ifdef USE_GCC_PRAGMAS #pragma implementation #endif #include <stdlib.h> #include <string.h> #include "goo/gmem.h" #include "FontEncodingTables.h" #include "BuiltinFont.h" //------------------------------------------------------------------------ BuiltinFontWidths::BuiltinFontWidths(BuiltinFontWidth *widths, int sizeA) { int i, h; size = sizeA; tab = (BuiltinFontWidth **)gmallocn(size, sizeof(BuiltinFontWidth *)); for (i = 0; i < size; ++i) { tab[i] = NULL; } for (i = 0; i < sizeA; ++i) { h = hash(widths[i].name); widths[i].next = tab[h]; tab[h] = &widths[i]; } } BuiltinFontWidths::~BuiltinFontWidths() { gfree(tab); } GBool BuiltinFontWidths::getWidth(char *name, Gushort *width) { int h; BuiltinFontWidth *p; h = hash(name); for (p = tab[h]; p; p = p->next) { if (!strcmp(p->name, name)) { *width = p->width; return gTrue; } } return gFalse; } int BuiltinFontWidths::hash(char *name) { char *p; unsigned int h; h = 0; for (p = name; *p; ++p) { h = 17 * h + (int)(*p & 0xff); } return (int)(h % size); }