Browse Source

Font SDF params;

bjorn 4 years ago
parent
commit
31deb49db3
2 changed files with 49 additions and 3 deletions
  1. 36 0
      api/init.lua
  2. 13 3
      api/lovr/graphics/newFont.lua

+ 36 - 0
api/init.lua

@@ -9669,6 +9669,18 @@ return {
                   type = "number",
                   description = "The size of the font, in pixels.",
                   default = "32"
+                },
+                {
+                  name = "padding",
+                  type = "number",
+                  description = "The number of pixels of padding around each glyph.",
+                  default = "2"
+                },
+                {
+                  name = "spread",
+                  type = "number",
+                  description = "The range of the distance field, in pixels.",
+                  default = "4.0"
                 }
               },
               returns = {
@@ -9687,6 +9699,18 @@ return {
                   type = "number",
                   description = "The size of the font, in pixels.",
                   default = "32"
+                },
+                {
+                  name = "padding",
+                  type = "number",
+                  description = "The number of pixels of padding around each glyph.",
+                  default = "2"
+                },
+                {
+                  name = "spread",
+                  type = "number",
+                  description = "The range of the distance field, in pixels.",
+                  default = "4.0"
                 }
               },
               returns = {
@@ -9703,6 +9727,18 @@ return {
                   name = "rasterizer",
                   type = "Rasterizer",
                   description = "The existing Rasterizer object used to render the glyphs."
+                },
+                {
+                  name = "padding",
+                  type = "number",
+                  description = "The number of pixels of padding around each glyph.",
+                  default = "2"
+                },
+                {
+                  name = "spread",
+                  type = "number",
+                  description = "The range of the distance field, in pixels.",
+                  default = "4.0"
                 }
               },
               returns = {

+ 13 - 3
api/lovr/graphics/newFont.lua

@@ -16,6 +16,16 @@ return {
       default = '32',
       description = 'The size of the font, in pixels.'
     },
+    padding = {
+      type = 'number',
+      default = '2',
+      description = 'The number of pixels of padding around each glyph.'
+    },
+    spread = {
+      type = 'number',
+      default = '4.0',
+      description = 'The range of the distance field, in pixels.'
+    },
     rasterizer = {
       type = 'Rasterizer',
       description = 'The existing Rasterizer object used to render the glyphs.'
@@ -29,16 +39,16 @@ return {
   },
   variants = {
     {
-      arguments = { 'filename', 'size' },
+      arguments = { 'filename', 'size', 'padding', 'spread' },
       returns = { 'font' }
     },
     {
       description = 'Creates a new Font from the default font included with LÖVR (Varela Round).',
-      arguments = { 'size' },
+      arguments = { 'size', 'padding', 'spread' },
       returns = { 'font' }
     },
     {
-      arguments = { 'rasterizer' },
+      arguments = { 'rasterizer', 'padding', 'spread' },
       returns = { 'font' }
     }
   },