Upped version number, improved text selection, and replaced noto kufi arabic with amiri
This commit is contained in:
parent
716f9222dc
commit
6b9a0562f6
11 changed files with 37 additions and 22 deletions
|
|
@ -57,7 +57,7 @@ FontData::FontData()
|
|||
map["Roboto"] = defaultFontMgr->makeFromFile("data/fonts/Roboto-variable.ttf");
|
||||
|
||||
collection = sk_make_sp<skia::textlayout::FontCollection>();
|
||||
collection->setDefaultFontManager(defaultFontMgr, std::vector<SkString>{SkString{"Roboto"}, SkString{"Noto Emoji"}, SkString{"Noto Kufi Arabic"}});
|
||||
collection->setDefaultFontManager(defaultFontMgr, std::vector<SkString>{SkString{"Roboto"}, SkString{"Noto Emoji"}, SkString{"Amiri"}});
|
||||
if(localFontMgr)
|
||||
collection->setDynamicFontManager(localFontMgr);
|
||||
std::string s = "🙂";
|
||||
|
|
@ -74,7 +74,7 @@ const std::vector<SkString>& FontData::get_default_font_families() const {
|
|||
defaultFontFamilies.emplace_back("Roboto");
|
||||
if(fallbackOnEmoji)
|
||||
defaultFontFamilies.emplace_back("Noto Emoji");
|
||||
defaultFontFamilies.emplace_back("Noto Kufi Arabic");
|
||||
defaultFontFamilies.emplace_back("Amiri");
|
||||
}
|
||||
return defaultFontFamilies;
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ void FontData::push_default_font_families(std::vector<SkString>& fontFamilies) c
|
|||
fontFamilies.emplace_back("Roboto");
|
||||
if(fallbackOnEmoji)
|
||||
fontFamilies.emplace_back("Noto Emoji");
|
||||
fontFamilies.emplace_back("Noto Kufi Arabic");
|
||||
fontFamilies.emplace_back("Amiri");
|
||||
}
|
||||
|
||||
FontData::~FontData() {
|
||||
|
|
|
|||
|
|
@ -174,28 +174,31 @@ void TextBox::process_key_input(Cursor& cur, InputKey in, bool ctrl, bool shift,
|
|||
}
|
||||
|
||||
void TextBox::process_mouse_left_button(Cursor& cur, const Vector2f& pos, int clickCount, bool held, bool shift) {
|
||||
if(!held)
|
||||
lastClicksWhileHeld = clickCount;
|
||||
else
|
||||
lastClicksWhileHeld = std::max(lastClicksWhileHeld, clickCount);
|
||||
if(clickCount == 1)
|
||||
lastClicksAtCursorPos = 1;
|
||||
else if(clickCount >= 2) {
|
||||
lastClicksAtCursorPos++;
|
||||
if(lastClicksAtCursorPos > 3)
|
||||
lastClicksAtCursorPos = 1;
|
||||
}
|
||||
|
||||
if(lastClicksWhileHeld || held) {
|
||||
if(clickCount || held) {
|
||||
rebuild();
|
||||
|
||||
Cursor oldCursor = cur;
|
||||
|
||||
cur.pos = get_text_pos_closest_to_point(pos);
|
||||
if(lastClicksCursorPos != cur.pos && clickCount) {
|
||||
lastClicksWhileHeld = std::min(1, lastClicksWhileHeld);
|
||||
lastClicksAtCursorPos = 1;
|
||||
lastClicksCursorPos = cur.pos;
|
||||
}
|
||||
cur.selectionBeginPos = cur.pos;
|
||||
if(lastClicksWhileHeld && !shift) {
|
||||
if(lastClicksAtCursorPos && !shift) {
|
||||
if(!cur.selectionEndPosBeforeHeld.has_value()) {
|
||||
cur.selectionEndPos = cur.selectionBeginPos;
|
||||
cur.selectionEndPosBeforeHeld = cur.selectionEndPos;
|
||||
}
|
||||
if(lastClicksWhileHeld == 3) {
|
||||
if(lastClicksAtCursorPos == 3) {
|
||||
cur.selectionEndPos = cur.selectionEndPosBeforeHeld.value();
|
||||
if(cur.selectionBeginPos < cur.selectionEndPos) {
|
||||
cur.selectionBeginPos.fTextByteIndex = 0;
|
||||
|
|
@ -206,7 +209,7 @@ void TextBox::process_mouse_left_button(Cursor& cur, const Vector2f& pos, int cl
|
|||
cur.selectionEndPos.fTextByteIndex = 0;
|
||||
}
|
||||
}
|
||||
else if(lastClicksWhileHeld == 2) {
|
||||
else if(lastClicksAtCursorPos == 2) {
|
||||
cur.selectionEndPos = cur.selectionEndPosBeforeHeld.value();
|
||||
if(cur.selectionBeginPos < cur.selectionEndPos) {
|
||||
cur.selectionBeginPos = move(Movement::LEFT_WORD_TIGHT, cur.selectionBeginPos);
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ class TextBox {
|
|||
unsigned tabWidth = 4;
|
||||
std::shared_ptr<FontData> fontData;
|
||||
|
||||
int lastClicksWhileHeld = 0;
|
||||
int lastClicksAtCursorPos = 0;
|
||||
TextPosition lastClicksCursorPos{0, 0};
|
||||
|
||||
struct ParagraphData {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,6 @@ namespace VersionConstants {
|
|||
|
||||
constexpr int SAVEFILE_HEADER_LEN = 12; // DO NOT CHANGE THIS HEADER LENGTH
|
||||
const std::string CURRENT_SAVEFILE_HEADER = "INFPNT000004"; // Change whenever the save file is incompatible with the previous version
|
||||
const std::string CURRENT_VERSION_STRING = "0.3.0";
|
||||
constexpr VersionNumber CURRENT_VERSION_NUMBER(0, 3, 0);
|
||||
const std::string CURRENT_VERSION_STRING = "0.3.1";
|
||||
constexpr VersionNumber CURRENT_VERSION_NUMBER(0, 3, 1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue