ReactOS 0.4.15-dev-7842-g558ab78
afangles.c File Reference
#include "aftypes.h"
Include dependency graph for afangles.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 af_sort_pos (FT_UInt count, FT_Pos *table)
 
 af_sort_and_quantize_widths (FT_UInt *count, AF_Width table, FT_Pos threshold)
 

Function Documentation

◆ af_sort_and_quantize_widths()

af_sort_and_quantize_widths ( FT_UInt count,
AF_Width  table,
FT_Pos  threshold 
)

Definition at line 210 of file afangles.c.

213 {
214 FT_UInt i, j;
215 FT_UInt cur_idx;
216 FT_Pos cur_val;
217 FT_Pos sum;
219
220
221 if ( *count == 1 )
222 return;
223
224 /* sort */
225 for ( i = 1; i < *count; i++ )
226 {
227 for ( j = i; j > 0; j-- )
228 {
229 if ( table[j].org >= table[j - 1].org )
230 break;
231
232 swap = table[j];
233 table[j] = table[j - 1];
234 table[j - 1] = swap;
235 }
236 }
237
238 cur_idx = 0;
239 cur_val = table[cur_idx].org;
240
241 /* compute and use mean values for clusters not larger than */
242 /* `threshold'; this is very primitive and might not yield */
243 /* the best result, but normally, using reference character */
244 /* `o', `*count' is 2, so the code below is fully sufficient */
245 for ( i = 1; i < *count; i++ )
246 {
247 if ( table[i].org - cur_val > threshold ||
248 i == *count - 1 )
249 {
250 sum = 0;
251
252 /* fix loop for end of array */
253 if ( table[i].org - cur_val <= threshold &&
254 i == *count - 1 )
255 i++;
256
257 for ( j = cur_idx; j < i; j++ )
258 {
259 sum += table[j].org;
260 table[j].org = 0;
261 }
262 table[cur_idx].org = sum / (FT_Pos)j;
263
264 if ( i < *count - 1 )
265 {
266 cur_idx = i + 1;
267 cur_val = table[cur_idx].org;
268 }
269 }
270 }
271
272 cur_idx = 1;
273
274 /* compress array to remove zero values */
275 for ( i = 1; i < *count; i++ )
276 {
277 if ( table[i].org )
278 table[cur_idx++] = table[i];
279 }
280
281 *count = cur_idx;
282 }
FT_BEGIN_HEADER struct AF_WidthRec_ AF_WidthRec
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
unsigned int FT_UInt
Definition: fttypes.h:231
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static char org[]
Definition: encode.c:7456
static int sum(int x_, int y_)
Definition: ptr2_test.cpp:35
#define swap(a, b)
Definition: qsort.c:63

Referenced by af_latin_metrics_init_widths().

◆ af_sort_pos()

af_sort_pos ( FT_UInt  count,
FT_Pos table 
)

Definition at line 187 of file afangles.c.

189 {
190 FT_UInt i, j;
191 FT_Pos swap;
192
193
194 for ( i = 1; i < count; i++ )
195 {
196 for ( j = i; j > 0; j-- )
197 {
198 if ( table[j] >= table[j - 1] )
199 break;
200
201 swap = table[j];
202 table[j] = table[j - 1];
203 table[j - 1] = swap;
204 }
205 }
206 }

Referenced by af_latin_metrics_init_blues().