static const char *hb_gpu_vertex_hlsl = "/*\n" " * Copyright (C) 2026 Behdad Esfahbod\n" " * Copyright (C) 2017 Eric Lengyel\n" " *\n" " * Based on the Slug algorithm by Eric Lengyel:\n" " * https://github.com/EricLengyel/Slug\n" " *\n" " * This is part of HarfBuzz, a text shaping library.\n" " *\n" " * Permission is hereby granted, without written agreement and without\n" " * license or royalty fees, to use, copy, modify, and distribute this\n" " * software and its documentation for any purpose, provided that the\n" " * above copyright notice and the following two paragraphs appear in\n" " * all copies of this software.\n" " *\n" " * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR\n" " * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES\n" " * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN\n" " * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\n" " * DAMAGE.\n" " *\n" " * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,\n" " * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n" " * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS\n" " * ON AN \"AS IS\" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO\n" " * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.\n" " */\n" "\n" "\n" "/* Requires Shader Model 5.0+. */\n" "\n" "\n" "/* Dilate a glyph vertex by half a pixel on screen.\n" " *\n" " * position: object-space vertex position (modified in place)\n" " * texcoord: em-space sample coordinates (modified in place)\n" " * normal: object-space outward normal at this vertex\n" " * jac: inverse of the 2x2 linear part of the em-to-object transform\n" " * m: model-view-projection matrix\n" " * viewport: viewport size in pixels\n" " */\n" "void hb_gpu_dilate (inout float2 position, inout float2 texcoord,\n" " float2 normal, float4 jac,\n" " float4x4 m, float2 viewport)\n" "{\n" " float2 n = normalize (normal);\n" "\n" " float4 clipPos = mul (m, float4 (position, 0.0, 1.0));\n" " float4 clipN = mul (m, float4 (n, 0.0, 0.0));\n" "\n" " float s = clipPos.w;\n" " float t = clipN.w;\n" "\n" " float u = (s * clipN.x - t * clipPos.x) * viewport.x;\n" " float v = (s * clipN.y - t * clipPos.y) * viewport.y;\n" "\n" " float s2 = s * s;\n" " float st = s * t;\n" " float uv = u * u + v * v;\n" "\n" " float denom = uv - st * st;\n" " float d = abs (denom) > 1.0 / 16777216.0\n" " ? s2 * (st + sqrt (uv)) / denom\n" " : 0.0;\n" "\n" " float2 dPos = d * normal;\n" " position += dPos;\n" " texcoord += float2 (dot (dPos, jac.xy), dot (dPos, jac.zw));\n" "}\n" ;