From 31d6b640eb2d7fcb529aa8c44426c26affc1c7b2 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 6 Mar 2019 14:50:27 +0100 Subject: [PATCH] Add a bold variant of Katica and make that the system's default bold font. ..and do some minor tweaks to the font rendering code. --- Base/res/fonts/Katica10.font | Bin 0 -> 10574 bytes Base/res/fonts/KaticaBold10.font | Bin 0 -> 10574 bytes LibGUI/GTextBox.cpp | 11 ++++++++--- SharedGraphics/Font.cpp | 2 +- SharedGraphics/Font.h | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 Base/res/fonts/Katica10.font create mode 100644 Base/res/fonts/KaticaBold10.font diff --git a/Base/res/fonts/Katica10.font b/Base/res/fonts/Katica10.font new file mode 100644 index 0000000000000000000000000000000000000000..092a506d005cd33b3202cb15dff23d5ccaef9b8e GIT binary patch literal 10574 zcmY#%%PV2$Vqjzd1MkF=%;ZEcbCehjfzc2c4S~@Rpg{KfkBjkfq@mu7J>3X;vjjDIuLeZ zU|>*%>gQl!U{GOTUFbFa*Fsy^BV`gAr0AZNF zpu!jw69WUdDgvp)hC%WmO&~cC8y5!2gVez=$X_5ogZv1hL424TG7S<3VR;4y1`rLx z$nyBuFt?!F4blTL4@8rSVP=8c0mCqRKr~1mhCyb7{09nmNd^W65C-{Gn1O)-ghApU zd5}7gS?oxD1o6=^NF7K$NS^=$0|N+y(g8>v%x;*!(ADuk)r0ha^n>I<=7IPU3=9k) z3`%z(3`(bvS4up}-1DOlrqpJmpfiOrOW*$f{$o(J;@&gEi z`~kxtbs+U1eK3rTk4>E%4*!DGB4dy{@$q4DAU7eiL40JrFh9V=K{UueAaR&J7!3+b z5F18=*ytE!HnJHYvp{^1I7lrl96(_R!XSG@M<@mOl5_^n=`sjzQue zd5}7oeoz^PjzM;SkCF#`hw2w!DjU;yEh3=9k)43Yz>1DU&+fq?;pmohLg zfbdEN28NAL43Y<_gM}YRA36qwD@Y!s4&)z@dtn&FM|Uqs9Y{S$AG%o=q3Q4rND%`A z14uv2ED#Oi!@>l_hq(`yKVWu&_^_}BsRQvrMuO4@D6indAa%&`jg1Y8SCBeTJ&TOF z7#J8}7-k1Z9n7Dgum@pKT!1hrufi}$9muU9jBEys4H5@oWOX1uOde(*j0UL#`42SkI+g<+67ka`#&8x4{NsRPM@+z;{x zh)*tt`2&=1Ky4sW%mJkhP#A&Y6yy$2y)6bc0NKC1NcA{K9SDQcBUCAz0+|PrgXsma zL1G{UAbVgKWCzGDkUR{7+yGLCj6r%q@*qEg%mlGPVjwl3dL9)1APjN~h(^aCb;uaq zUXYz2H-XFqnGeI*{0p)hW){dE5E~TcAT~0F#V<%66vrSM6fYn)ItJ;7*$JXS`5RRB zfy6;Hh!4tRATvN>$o61kgVZ5ob7+|d%6A|P%ZtcrKx{((1*rjHP&k3Y0U3kDKyt_! z-8@kIfcyu-$m(##2PjUE)q%_d`5&Yo86&F!u|aMDxeY{v%z&{$a>(HYat|^e#0I4& zkUC@x(vOTmX%^&WWHlf*ObsYMgD@@m$RyJ04HYO$}R#qlfMrKxKR#rAv5MX3tVP#=uXJ=(&V`XJyV`gPzV`pP$We4$C n*;!dxnVFecLCRTKSy@0lRwj@rD@Yeeo`r>xg^hsiw3h|||4VVC literal 0 HcmV?d00001 diff --git a/Base/res/fonts/KaticaBold10.font b/Base/res/fonts/KaticaBold10.font new file mode 100644 index 0000000000000000000000000000000000000000..7f6067f7803a69fa0d3ebb639bca14cbd0698017 GIT binary patch literal 10574 zcmY#%%PV2$Vqjzd1MkF=%;ZD`r~I50Fn^R74S~@R7!85Z5TI@dFf%YPV8b9=VB#RQ z5Ca2)Gy?+zCy0Xwn=vpjfN(tn1H(2b8^r&Q#0F{SVPIg8V_;ygXJBC9hq7&;e2_Ru z9;6P0l^7Tp%o!LMq!<_&K;mKy3=Gx`3=D!GNhHh%btA}~AT~(NY^d6GP<1drL8}?4 zC?>^*BV1tmLGmD7AU=qV3xniA>R=e;evqF*G{~REFbOmoBoD$cwIDW{5}aHnsN1pm zQ68r*+!7!^fG|h}$Q>|@>}QZX41?6c{052x5C+8`2!s3!!XSB&I*?hQ_y^IrFi0Ip zJxHGc0|SEuG#!BKhuH}VCv4%vGqCtF6n1C>d4{{?& zDJYyle2`u2(0UbAzJc-zNE{>&QU?kjP+q}@LFzzy@L`yFAp4OqNF0V?c7V)7_a`V0 zK=A>J7nmGK9Vk75Feq$5VFb&gAU;SOghA?%-G*)-vb~`20;N5e7%aVl!U=>y@*wj- zVFu#k!XSB&I%Ij6Ss)r_K8OaX1E~jzX0$WJdiw0FNh5i1E~So1H&LYKyt_!BnDE4 zj6r%qYCvfhWG09W5(B9Lr4d*dgWLjRBhw&t$QWb?$P5?;@j-3^nF%rWy5_@MXz zVURowgTet69w7b57$y&+L2dz=2MTXcegLsSVjy|sumZUUnGa%v(i2D>G6v~K#~?Q% zs{yfLYCv{@Ff5)ya>y7I{-AgO#R&+*`b)@aKx~kC$mW39ATf{}G6spkFsRK9Dl0)@ z2U3r$4&+}@c!1mm@+&9|L1G{^FmaF^2!qlYh=yU1JV+f#44iG*GH8Y!mfdOPD$PAb| z5E~>0!XSG=YCsso2g!ldf!qzlj!-jTe2^O0d=E%%ECT}r2!qst#6cLu28n?%NDVsy zz|6$T&c?>Z#LUdb#>C3R!p6eJ1`+@Xv9hwVv9p5^D?1wtD?1wmvazv&#h6)`S;2yA dY^-c-EG%ryV2!LG9y=QwD=QN#0n6zi4FIOgqpkn| literal 0 HcmV?d00001 diff --git a/LibGUI/GTextBox.cpp b/LibGUI/GTextBox.cpp index 23302d77c1d..5ebc9621286 100644 --- a/LibGUI/GTextBox.cpp +++ b/LibGUI/GTextBox.cpp @@ -76,7 +76,7 @@ void GTextBox::paint_event(GPaintEvent& event) Painter painter(*this); painter.set_clip_rect(event.rect()); - painter.fill_rect({ rect().x() + 1, rect().y() + 1, rect().width() - 2, rect().height() - 2 }, background_color()); + painter.fill_rect(rect().shrunken(2, 2), background_color()); painter.draw_rect(rect(), foreground_color()); if (is_focused()) @@ -88,9 +88,9 @@ void GTextBox::paint_event(GPaintEvent& event) painter.set_clip_rect(inner_rect); painter.translate(-m_scroll_offset, 0); - int y = inner_rect.center().y() - font().glyph_height() / 2; int space_width = font().glyph_width(' ') + font().glyph_spacing(); int x = inner_rect.x(); + int y = inner_rect.center().y() - font().glyph_height() / 2; for (int i = 0; i < m_text.length(); ++i) { char ch = m_text[i]; @@ -103,7 +103,12 @@ void GTextBox::paint_event(GPaintEvent& event) } if (is_focused() && m_cursor_blink_state) { - Rect cursor_rect(inner_rect.x() + cursor_content_position().x(), inner_rect.y(), 1, inner_rect.height()); + Rect cursor_rect { + inner_rect.x() + cursor_content_position().x(), + inner_rect.y(), + 1, + inner_rect.height() + }; painter.fill_rect(cursor_rect, foreground_color()); } } diff --git a/SharedGraphics/Font.cpp b/SharedGraphics/Font.cpp index 990853a4931..aca394a3b6b 100644 --- a/SharedGraphics/Font.cpp +++ b/SharedGraphics/Font.cpp @@ -44,7 +44,7 @@ Font& Font::default_fixed_width_font() Font& Font::default_bold_font() { static Font* s_default_bold_font; - static const char* default_bold_font_path = "/res/fonts/CsillaBold7x10.font"; + static const char* default_bold_font_path = "/res/fonts/KaticaBold10.font"; if (!s_default_bold_font) { s_default_bold_font = Font::load_from_file(default_bold_font_path).leak_ref(); ASSERT(s_default_bold_font); diff --git a/SharedGraphics/Font.h b/SharedGraphics/Font.h index b0b479ac5ca..e972974c78f 100644 --- a/SharedGraphics/Font.h +++ b/SharedGraphics/Font.h @@ -54,7 +54,7 @@ public: ~Font(); - GlyphBitmap glyph_bitmap(char ch) const { return GlyphBitmap(&m_rows[(byte)ch * m_glyph_height], { m_glyph_width, m_glyph_height }); } + GlyphBitmap glyph_bitmap(char ch) const { return GlyphBitmap(&m_rows[(byte)ch * m_glyph_height], { glyph_width(ch), m_glyph_height }); } byte glyph_width(char ch) const { return m_fixed_width ? m_glyph_width : m_glyph_widths[(byte)ch]; } byte glyph_height() const { return m_glyph_height; }