[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-75162":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":28,"readmeContent":29,"aiSummary":30,"trendingCount":15,"starSnapshotCount":15,"syncStatus":31,"lastSyncTime":32,"discoverSource":33},75162,"Slug","EricLengyel\u002FSlug","EricLengyel","Reference code for the Slug Algorithm.","",null,"HLSL",1409,70,15,0,10,14,41,30,18.55,"Other",false,"main",true,[26,27],"font-rendering","vector-graphics","2026-06-12 02:03:33","# Slug\nThis repository contains reference shader implementations for the Slug font rendering algorithm. The code itself contains many comments providing details about the inputs and the calculations performed.\n\nFor information about how the core algorithm works, see the 2017 paper in the Journal of Computer Graphics Techniques:\n\nhttps:\u002F\u002Fjcgt.org\u002Fpublished\u002F0006\u002F02\u002F02\u002F\n\nUpdated information about changes that have occurred over the years can be found in the following blog post:\n\nhttps:\u002F\u002Fterathon.com\u002Fblog\u002Fdecade-slug.html\n\nThe code in this repository may be freely used by anyone for any purpose. The patent has been dedicated to the public domain. If you do use this code in software that gets distributed in any way, then you are required to give credit.\n\n## Tips and Tricks\n\n* The curve texture should have four 16-bit floating-point channels that hold control point coordinates (x1, y1, x2, y2). The first two control points for one quadratic Bézier curve are packed into one texel, and the third control point is stored in the first two channels of the next texel. When following a contour composed of connected Bézier curves, the second texel for one curve is also the first texel for the next curve because they share an endpoint.\n* The band texture should have two 16-bit unsigned integer channels. A glyph can have any number of horizontal and vertical bands, and the number you choose should be optimized to minimize the maximum number of curves in any single band. When determining which curves fall into each band, use an epsilon such as 1\u002F1024 in em-space to make the bands overlap slightly. The curves in each band must be sorted in descending order of their maximum x coordinate (for horizontal bands) or y coordinate (for vertical bands).\n* Each band for a single glyph must have the same thickness, but if two or more adjacent bands end up containing the same set of curves, then you can just point all of them to the same data. It's also possible that some bands use a contiguous subset of the curves contained in another band, and in that case, you can point the smaller band to the subset of the data for the larger band. (These optimizations aren't required, but they reduce the data size and improve texture cache performance.)\n* Remeber that any curves that are straight horizontal lines should never be included in horizontal bands, and any curves that are straight vertical lines should never be included in vertical bands. These curves cannot make a contribution to the winding number for rays parallel to them.\n* This algorithm ignores font hinting, but you can still ensure that the tops and bottoms of many glyphs are vertically aligned to the pixel grid by choosing the right font size. Grab the sCapHeight field of the 'OS\u002F2' table in the original font, and make sure that the font size multiplied by sCapHeight is an integer. Don't forget to account for monitor DPI when determining how many pixels tall glyphs will be. [Radical Pie](https:\u002F\u002Fradicalpie.com\u002F) applies this scaling throughout its user interface if you'd like to see an example.\n* The best way to encode a straight line as a quadratic Bézier curve is to duplicate the second endpoint. That is, to make a line that goes from p1 to p2, use a quadratic curve with control points {p1, p2, p2}.\n","Slug项目提供了一种用于字体渲染的算法实现，特别针对Shader编写。它基于HLSL语言，通过使用曲线纹理和带状纹理来优化字体渲染过程中的性能与质量。其核心技术特点包括采用二次贝塞尔曲线进行字符轮廓描述，并通过将曲线分组到水平或垂直带中以减少计算复杂度。此外，项目还提供了一系列技巧以进一步优化存储空间及提升渲染效率。此算法适用于需要高质量矢量图形渲染的应用场景，如游戏开发、WebGL应用等，尤其在对字体清晰度要求较高的环境中表现优异。",2,"2026-06-11 03:52:33","high_star"]