This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] Enable local glyph generation using TinySDF.
- Platform-specific LocalGlyphRasterizer is responsible for deciding which glyphs to rasterize locally and for implementing the rasterization. - Default platform implementation doesn't locally generate any glyphs -> no behavior change - Unit test uses StubLocalGlyphRasterizer, which returns a single fixed bitmap for all CJK glyphs - Rename glyph_loader.test to glyph_manager.test
- Loading branch information
Showing
13 changed files
with
428 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <mbgl/text/local_glyph_rasterizer.hpp> | ||
|
||
namespace mbgl { | ||
|
||
bool LocalGlyphRasterizer::canRasterizeGlyph(const FontStack&, GlyphID) { | ||
return false; | ||
} | ||
|
||
Glyph LocalGlyphRasterizer::rasterizeGlyph(const FontStack&, GlyphID) { | ||
return Glyph(); | ||
} | ||
|
||
} // namespace mbgl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#pragma once | ||
|
||
#include <mbgl/text/glyph.hpp> | ||
|
||
namespace mbgl { | ||
|
||
/* | ||
Given a font stack and a glyph ID, platform-specific implementations of | ||
LocalGlyphRasterizer will decide which, if any, local fonts to use and | ||
then generate a matching glyph object with a greyscale rasterization of | ||
the glyph and appropriate metrics. GlyphManager will then use TinySDF to | ||
transform the rasterized bitmap into an SDF. | ||
The JS equivalent of this functionality will only generate glyphs in the | ||
'CJK Unified Ideographs' and 'Hangul Syllables' ranges, for which it can | ||
get away with rendering a fixed 30px square image and GlyphMetrics of: | ||
width: 24, | ||
height: 24, | ||
left: 0, | ||
top: -8, | ||
advance: 24 | ||
The JS equivalent also uses heuristic evaluation of the font stack name | ||
to control the font-weight it uses during rasterization. | ||
It is left to platform-specific implementation to decide how best to | ||
map a FontStack to a particular rasterization. | ||
The default implementation simply refuses to rasterize any glyphs. | ||
*/ | ||
|
||
class LocalGlyphRasterizer { | ||
public: | ||
virtual ~LocalGlyphRasterizer() = default; | ||
|
||
// virtual so that test harness can override platform-specific behavior | ||
virtual bool canRasterizeGlyph(const FontStack&, GlyphID); | ||
virtual Glyph rasterizeGlyph(const FontStack&, GlyphID); | ||
}; | ||
|
||
} // namespace mbgl |
Oops, something went wrong.