Update skia version, and start work on getting harfbuzz shaper working
This commit is contained in:
parent
79d768e8f6
commit
525da85f51
12 changed files with 117 additions and 36 deletions
|
|
@ -209,7 +209,7 @@ static void set_character_bounds(void* context,
|
|||
SkFontMetrics metrics;
|
||||
font.getMetrics(&metrics);
|
||||
std::unique_ptr<float[]> advances(new float[glyphCount]);
|
||||
font.getWidths(glyphs, glyphCount, advances.get());
|
||||
font.getWidths({glyphs, glyphCount}, {advances.get(), glyphCount});
|
||||
|
||||
// Loop over each cluster in this run.
|
||||
size_t clusterStart = 0;
|
||||
|
|
@ -284,10 +284,11 @@ CollabTextBox::ShapeResult CollabTextBox::shape(const char* utf8Text,
|
|||
std::unique_ptr<SkShaper> shaper = nullptr;
|
||||
auto unicode = get_unicode_2();
|
||||
|
||||
// USING PRIMITIVE WRAPPER INSTEAD OF HARFBUZZ, BECAUSE HARFBUZZ HAS ISSUES ON EMSCRIPTEN
|
||||
// WE MIGHT HAVE TO CHANGE THIS BACK LATER WHEN THERE'S A FIX
|
||||
//shaper = SkShapers::HB::ShaperDrivenWrapper(unicode, fontMgr);
|
||||
shaper = SkShaper::MakePrimitive();
|
||||
//#ifdef __EMSCRIPTEN__
|
||||
//shaper = SkShaper::MakePrimitive();
|
||||
//#else
|
||||
shaper = SkShapers::HB::ShaperDrivenWrapper(unicode, fontMgr);
|
||||
//#endif
|
||||
|
||||
SkASSERT(shaper);
|
||||
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ void DrawBrushStroke::create_triangles(const std::function<bool(Vector2f, Vector
|
|||
|
||||
if(pointsN.size() < 2) {
|
||||
if(bPath && !topPoints.empty())
|
||||
bPath->addPoly(topPoints.data(), topPoints.size(), false);
|
||||
bPath->addPoly({topPoints.data(), topPoints.size()}, false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -381,7 +381,7 @@ void DrawBrushStroke::create_triangles(const std::function<bool(Vector2f, Vector
|
|||
|
||||
if(bPath && !topPoints.empty()) {
|
||||
topPoints.insert(topPoints.begin(), bottomPoints.rbegin(), bottomPoints.rend());
|
||||
bPath->addPoly(topPoints.data(), topPoints.size(), false);
|
||||
bPath->addPoly({topPoints.data(), topPoints.size()}, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -408,7 +408,7 @@ bool DrawingProgram::prevent_undo_or_redo() {
|
|||
SkPaint DrawingProgram::select_tool_line_paint() {
|
||||
SkScalar intervals[] = {10, 5};
|
||||
float timeSinceEpoch = std::chrono::duration_cast<std::chrono::duration<float>>(std::chrono::steady_clock::now().time_since_epoch()).count();
|
||||
sk_sp<SkPathEffect> lassoLineDashEffect = SkDashPathEffect::Make(intervals, 2, -std::fmod(timeSinceEpoch * 50, 15));
|
||||
sk_sp<SkPathEffect> lassoLineDashEffect = SkDashPathEffect::Make({intervals, 2}, -std::fmod(timeSinceEpoch * 50, 15));
|
||||
|
||||
SkPaint selectLinePaint;
|
||||
selectLinePaint.setStyle(SkPaint::kStroke_Style);
|
||||
|
|
|
|||
|
|
@ -5,9 +5,29 @@
|
|||
#include <include/core/SkTextBlob.h>
|
||||
#include <iostream>
|
||||
|
||||
FontData::FontData():
|
||||
mgr(SkFontMgr_New_Custom_Empty())
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#elif _WIN32
|
||||
#include <include/ports/SkTypeface_win.h>
|
||||
#elif __APPLE__
|
||||
#include <include/ports/SkFontMgr_mac_ct.h>
|
||||
#elif __linux__
|
||||
#include <include/ports/SkFontMgr_fontconfig.h>
|
||||
#include <include/ports/SkFontScanner_FreeType.h>
|
||||
#endif
|
||||
|
||||
FontData::FontData()
|
||||
{
|
||||
#ifdef __EMSCRIPTEN__
|
||||
mgr = SkFontMgr_New_Custom_Empty();
|
||||
#elif _WIN32
|
||||
mgr = SkFontMgr_New_GDI();
|
||||
#elif __APPLE__
|
||||
mgr = SkFontMgr_New_Custom_Empty();
|
||||
#elif __linux__
|
||||
mgr = SkFontMgr_New_FontConfig(nullptr, SkFontScanner_Make_FreeType());
|
||||
#else
|
||||
mgr = SkFontMgr_New_Custom_Empty();
|
||||
#endif
|
||||
map["Roboto"] = mgr->makeFromFile("data/fonts/Roboto-variable.ttf");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue