patch-render_c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. $OpenBSD: patch-render_c,v 1.1.1.1 2016/10/07 21:49:45 czarkoff Exp $
  2. We make GNU Backgammon use system-supplied DejaVu fonts instead of bundling Vera
  3. fonts. Thus stop building dynamically allocated paths for fonts.
  4. --- render.c.orig Sun Oct 19 23:24:53 2014
  5. +++ render.c Tue Apr 7 11:21:30 2015
  6. @@ -52,14 +52,6 @@
  7. static randctx rc;
  8. #define RAND irand( &rc )
  9. -#if HAVE_FREETYPE
  10. -#define FONT_VERA "fonts/Vera.ttf"
  11. -#define FONT_VERA_SERIF_BOLD "fonts/VeraSeBd.ttf"
  12. -#if 0 /* unused for now */
  13. -#define FONT_VERA_BOLD "fonts/VeraBd.ttf"
  14. -#endif
  15. -#endif
  16. -
  17. /* aaanPositions[Clockwise][x][point number][x, y. deltay] */
  18. int positions[2][30][3] = { {
  19. {BAR_X, BAR_Y_1, -CHEQUER_HEIGHT}, /* bar - player 1 */
  20. @@ -1475,15 +1467,11 @@ RenderLabels(renderdata * prd, unsigned char *puch, in
  21. FT_Face ftf;
  22. int i;
  23. FT_Glyph aftg[10];
  24. - char *file;
  25. - file = BuildFilename(FONT_VERA);
  26. - if (FT_New_Face(ftl, file, 0, &ftf)) {
  27. + if (FT_New_Face(ftl, FONT_VERA, 0, &ftf)) {
  28. RenderBasicLabels(prd, puch, nStride, iStart, iEnd, iDelta);
  29. - g_free(file);
  30. return;
  31. }
  32. - g_free(file);
  33. if (FT_Set_Pixel_Sizes(ftf, 0, prd->nSize * 5 / 2)) {
  34. RenderBasicLabels(prd, puch, nStride, iStart, iEnd, iDelta);
  35. @@ -1761,10 +1749,8 @@ RenderChequerLabels(renderdata * prd, unsigned char *p
  36. FT_Face ftf;
  37. FT_Glyph aftg[10];
  38. int fFreetype = FALSE;
  39. - char *file;
  40. - file = BuildFilename(FONT_VERA);
  41. - if (!FT_New_Face(ftl, file, 0, &ftf) && !FT_Set_Pixel_Sizes(ftf, 0, 2 * prd->nSize)) {
  42. + if (!FT_New_Face(ftl, FONT_VERA, 0, &ftf) && !FT_Set_Pixel_Sizes(ftf, 0, 2 * prd->nSize)) {
  43. fFreetype = TRUE;
  44. for (i = 0; i < 10; i++) {
  45. FT_Load_Char(ftf, '0' + i, FT_LOAD_RENDER);
  46. @@ -1773,7 +1759,6 @@ RenderChequerLabels(renderdata * prd, unsigned char *p
  47. FT_Done_Face(ftf);
  48. }
  49. - g_free(file);
  50. #endif
  51. for (i = 0; i < 12; i++) {
  52. @@ -1932,8 +1917,7 @@ RenderCubeFaces(renderdata * prd, unsigned char *puch,
  53. int fFreetype = FALSE;
  54. char *file;
  55. - file = BuildFilename(FONT_VERA_SERIF_BOLD);
  56. - if (!FT_New_Face(ftl, file, 0, &ftf) && !FT_Set_Pixel_Sizes(ftf, 0, 3 * prd->nSize)) {
  57. + if (!FT_New_Face(ftl, FONT_VERA_SERIF_BOLD, 0, &ftf) && !FT_Set_Pixel_Sizes(ftf, 0, 3 * prd->nSize)) {
  58. fFreetype = TRUE;
  59. for (i = 0; i < 10; i++) {
  60. @@ -1950,7 +1934,6 @@ RenderCubeFaces(renderdata * prd, unsigned char *puch,
  61. FT_Done_Face(ftf);
  62. }
  63. - g_free(file);
  64. #endif
  65. for (i = 0; i < 6; i++) {
  66. @@ -2010,8 +1993,7 @@ RenderResignFaces(renderdata * prd, unsigned char *puc
  67. int fFreetype = FALSE;
  68. char *file;
  69. - file = BuildFilename(FONT_VERA_SERIF_BOLD);
  70. - if (!FT_New_Face(ftl, file, 0, &ftf) && !FT_Set_Pixel_Sizes(ftf, 0, 4 * prd->nSize)) {
  71. + if (!FT_New_Face(ftl, FONT_VERA_SERIF_BOLD, 0, &ftf) && !FT_Set_Pixel_Sizes(ftf, 0, 4 * prd->nSize)) {
  72. fFreetype = TRUE;
  73. for (i = 0; i < 10; i++) {
  74. @@ -2028,7 +2010,6 @@ RenderResignFaces(renderdata * prd, unsigned char *puc
  75. FT_Done_Face(ftf);
  76. }
  77. - g_free(file);
  78. #endif
  79. for (i = 0; i < 3; i++) {