Commit Graph

65 Commits

Author SHA1 Message Date
Sasha Szpakowski 7d49d880d7 Improve truetype font text positioning with fractional glyph advances and DPI-scaled coordinates.
Disallow Font:setFallbacks for fonts that have different DPI scales.
It's still too easy to render text at a non-integer pixel when fractional DPI scales are used, so maybe a more thorough redesign would be useful.

Fixes #2318.
Fixes #2168.
2026-06-21 16:30:43 -03:00
John Doe fc5eeb11a3 Fix copyright notice date 2026-01-21 18:49:11 +00:00
John Doe 6f08eb94c6 Update copyright notice with correct year 2025-07-12 23:19:22 +01:00
Ron Tseytlin d4a2c460de Ignore last space in justified text 2024-12-16 22:50:43 +02:00
Ron Tseytlin 7e34e0ad21 Improve justified text alignment 2024-12-16 21:46:22 +02:00
Sasha Szpakowski 50ff1e4d2b use location numbers for vertex input attributes, instead of name-based binding.
- add 'location' named field to buffer and mesh vertex format tables, replaces 'name' field.
- location numbers are expected to match 'layout (location = #)' qualifiers in vertex inputs in shader code.
- deprecate vertex inputs in shader code that don't have layout location qualifiers.
- love's default vertex attributes use location 0 for position, 1 for texcoord, and 2 for color.
- add new variants of Mesh:attachAttribute, setAttributeEnabled, and isAttributeEnabled which take location numbers instead of names.

Improves draw performance in vulkan and metal backends.
2024-09-07 18:06:03 -03:00
Sasha Szpakowski 7a4380514e Improve letter spacing and line heights of high dpi text.
resolves #1918
2024-07-07 16:54:18 -03:00
Sasha Szpakowski 05288b3e70 fix build 2024-07-06 15:39:26 -03:00
Sasha Szpakowski 248fbb9eb1 Fix the left side of quads in text with non-1.0 dpi scales.
issue #1918
2024-07-06 15:32:58 -03:00
Sasha Szpakowski c1fddfe3bc Fix initial texture atlas size of fonts with high dpi scales 2024-07-06 15:31:11 -03:00
Sasha Szpakowski 64a30f177f Merge branch 'main' into 12.0-development 2024-02-10 12:24:48 -04:00
Sasha Szpakowski 94d5864144 update year for copyright notice 2024-02-10 12:13:22 -04:00
Sasha Szpakowski d085f44e6a Merge branch '12.0-development' into text-shaping 2023-01-01 12:18:54 -04:00
Sasha Szpakowski f6cdbdc868 Merge branch 'main' into 12.0-development 2022-12-31 22:46:34 -04:00
Sasha Szpakowski c823dbca96 Update copyright year for 2023 2022-12-31 22:25:49 -04:00
Sasha Szpakowski 9502942b7b font rendering: reimplement tab-as-spaces support. 2022-12-28 19:46:48 -04:00
Sasha Szpakowski 7a0f6621e7 Initial (WIP) Harfbuzz text shaping integration.
This a significant refactor / rewrite of much of the love.graphics Font code.
Text positioning is now split into TextShaper classes in the love.font module. This isn't exposed to users yet.
BMFonts and ImageFonts use the same text shaping as before (in the new TextShaper API). Fonts loaded via FreeType now use Harfbuzz for text shaping.

The new code isn't at feature-parity with the old code yet. Harfbuzz-based text shaping enables kerning support in more fonts, character combining into ligature glyphs, and directions other than left-to-right (this isn't supported in love yet).
2022-12-26 19:06:08 -04:00
Alex Szpakowski 1cf0073cf4 metal: use a fallback for fonts when luminance-alpha isn't supported. 2022-01-22 14:41:42 -04:00
Alex Szpakowski 7f3538d2ba Merge branch 'main' into 12.0-development 2022-01-05 21:10:27 -04:00
Alex Szpakowski 8e7fd10b6f Update copyright year for 2022 2021-12-31 18:33:40 -04:00
Alex Szpakowski c8038f22df Merge branch 'main' into 12.0-development 2021-12-24 11:35:35 -04:00
Semyon Yentsov a57d207a57 Fix bug #1707 2021-11-01 01:37:18 +03:00
Alex Szpakowski 8a48f1b733 Merge branch 'main' into 12.0-development 2021-10-19 21:50:19 -03:00
Jack Robinson bfca659e37 Fix #1721: floor result of scaling kerning based on dpi 2021-08-31 21:22:06 +12:00
Alex Szpakowski 21f5ba86d3 Merge branch 'master' into 12.0-development 2021-04-07 20:33:44 -03:00
Alex Szpakowski 7b6978f052 Add Font:getKerning.
Also add a variant of Font:getWidth which accepts a codepoint number.
Fixes #1403
2021-04-05 11:22:54 -03:00
Alex Szpakowski f89aabb0bb Update copyright year for 2021 2021-04-04 16:14:45 -03:00
Alex Szpakowski c991f999eb Account for different DPI scales in font fallbacks.
Fixes #1675
2021-04-04 16:01:22 -03:00
Alex Szpakowski 7fbb68e90e Merge branch '12.0-development' into GraphicsBuffer 2020-02-28 23:10:21 -04:00
Alex Szpakowski 9425c9224b Rename internal batched draw code to be more clear 2020-02-27 20:08:50 -04:00
Alex Szpakowski b1c028a4d3 Merge branch '12.0' into GraphicsBuffer 2020-02-17 16:31:02 -04:00
Alex Szpakowski 12c90b3dca Merge Image and Canvas GL backend classes into new common Texture class. 2020-02-07 20:29:21 -04:00
Alex Szpakowski 17f77407bb Replace internal C++ newImage and newCanvas methods with newTexture 2020-02-05 20:39:55 -04:00
Alex Szpakowski 258129738f Remove graphics::Canvas and graphics::Image 2020-02-04 22:06:55 -04:00
Alex Szpakowski b71eaf73cc Replaced some references to Image and Canvas with Texture. 2020-02-04 20:52:57 -04:00
Alex Szpakowski f9248d478c Refactor sampler state parameters for textures. 2020-02-02 22:26:28 -04:00
Alex Szpakowski 2572f0c7a1 Meshes expose GraphicsBuffers, part 2 2020-02-01 15:39:59 -04:00
Alex Szpakowski ee5304ba53 Remove vertex namespace 2020-01-13 20:41:05 -04:00
Alex Szpakowski 5f9b5a21d0 Merge default into minor
--HG--
branch : minor
2020-01-03 22:45:36 -04:00
Alex Szpakowski fc4847c69d Update copyright for the new year 2020-01-03 22:40:36 -04:00
Alex Szpakowski f3b52f66fe Update the internal naming convention for pixel formats.
--HG--
branch : minor
2019-12-23 23:38:04 -04:00
Alex Szpakowski 9ab2a94037 Rename internal C++ Color struct to Color32 to help differentiate it from Colorf. 2019-09-14 23:13:40 -03:00
Alex Szpakowski 02fa8b0b2b Fill truetype font glyph atlases with transparent white instead of transparent black in the borders between glyphs. Fixes black fringes around text (resolves issue #1495) and reduces the appearance of flickering when text is moved at non-integer coordinates and gamma correct rendering isn't enabled (closes issue #1143). 2019-05-27 19:36:22 -03:00
Alex Szpakowski 1bb50fccac Reduce peak memory usage when a font's glyph atlas needs to be recreated. 2019-01-16 18:21:58 -04:00
Alex Szpakowski 0752f27bdf Update copyright year for 2019 2019-01-03 21:09:05 -04:00
Alex Szpakowski 752c5b70f1 Fix font vertex generation skipping the first glyph in the string if it restarts its loop due to its texture atlas being recreated to make room for more glyphs. Resolves issue #1452. 2018-12-27 21:16:45 -04:00
Alex Szpakowski 22f72c7da6 Fix a crash in Image:replacePixels when a different ImageData is given than the one that created the Image. 2018-01-10 21:31:00 -04:00
Bart van Strien e80247c191 Happy new year! 2018-01-03 19:47:35 +01:00
Alex Szpakowski 7354de2059 Add (low level) functionality to allow rendering 3D Meshes.
- Add love.graphics.setDepthMode(testcomparison, enablewrites).
- Add love.graphics.setMeshCullMode.
- Add love.graphics.setFrontFaceWinding.

Depth testing and depth writes require a depth buffer to work. The mesh cull mode controls whether front/back faces of a mesh are culled. The front face winding determines whether a clockwise or counterclockwise-oriented face in a mesh is considered front facing.

--HG--
branch : minor
2017-12-09 23:34:08 -04:00
Alex Szpakowski 6dea2ab714 Clamp all color arguments to [0, 1] in cases where values outside that range don't make sense (fixed-point color values & sRGB colors). Closes issue #1315.
--HG--
branch : minor
2017-11-21 19:49:52 -04:00