-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Description
Description of the new feature
Windows added 3D Fluent emoji support in 23H2. Supporting 3D Fluent emoji in Windows Terminal would be a nice addition.
Proposed technical implementation details
3D Fluent emojis are implemented in COLRv1 format. We'd have to support drawing DWRITE_GLYPH_IMAGE_FORMATS_COLR
here:
terminal/src/renderer/atlas/Backend.cpp
Lines 73 to 105 in bd7e317
void Microsoft::Console::Render::Atlas::ColorGlyphRunDraw(ID2D1DeviceContext4* d2dRenderTarget4, ID2D1SolidColorBrush* emojiBrush, ID2D1SolidColorBrush* foregroundBrush, const DWRITE_COLOR_GLYPH_RUN1* colorGlyphRun) noexcept | |
{ | |
ID2D1Brush* runBrush = nullptr; | |
if (colorGlyphRun->paletteIndex == /*DWRITE_NO_PALETTE_INDEX*/ 0xffff) | |
{ | |
runBrush = foregroundBrush; | |
} | |
else | |
{ | |
emojiBrush->SetColor(&colorGlyphRun->runColor); | |
runBrush = emojiBrush; | |
} | |
const D2D1_POINT_2F baselineOrigin{ colorGlyphRun->baselineOriginX, colorGlyphRun->baselineOriginY }; | |
switch (colorGlyphRun->glyphImageFormat) | |
{ | |
case DWRITE_GLYPH_IMAGE_FORMATS_NONE: | |
break; | |
case DWRITE_GLYPH_IMAGE_FORMATS_PNG: | |
case DWRITE_GLYPH_IMAGE_FORMATS_JPEG: | |
case DWRITE_GLYPH_IMAGE_FORMATS_TIFF: | |
case DWRITE_GLYPH_IMAGE_FORMATS_PREMULTIPLIED_B8G8R8A8: | |
d2dRenderTarget4->DrawColorBitmapGlyphRun(colorGlyphRun->glyphImageFormat, baselineOrigin, &colorGlyphRun->glyphRun, colorGlyphRun->measuringMode, D2D1_COLOR_BITMAP_GLYPH_SNAP_OPTION_DEFAULT); | |
break; | |
case DWRITE_GLYPH_IMAGE_FORMATS_SVG: | |
d2dRenderTarget4->DrawSvgGlyphRun(baselineOrigin, &colorGlyphRun->glyphRun, runBrush, nullptr, 0, colorGlyphRun->measuringMode); | |
break; | |
default: | |
d2dRenderTarget4->DrawGlyphRun(baselineOrigin, &colorGlyphRun->glyphRun, colorGlyphRun->glyphRunDescription, runBrush, colorGlyphRun->measuringMode); | |
break; | |
} | |
} |
Resources:
https://learn.microsoft.com/en-us/windows/win32/directwrite/color-fonts-preview#layers-of-solid-color-glyphs
https://learn.microsoft.com/en-us/typography/opentype/spec/colr#colr-version-1-rendering-algorithm
https://blogs.windows.com/windows-insider/2023/07/12/announcing-windows-11-insider-preview-build-25905
https://learn.microsoft.com/en-us/windows/win32/api/dcommon/ne-dcommon-dwrite_glyph_image_formats