Draw: GetStdFontCy now obtained from non-bold font

git-svn-id: svn://ultimatepp.org/upp/trunk@14026 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-02-17 14:00:02 +00:00
parent 2b14621919
commit 0f8135ea77
6 changed files with 10 additions and 17 deletions

View file

@ -4,6 +4,10 @@
- Make allocator work
- FileChooser
- InsetFrame vs DefaultFrame
- MacOS crash when addint Label to TestChStyles
- Ide: When dark editor in light theme, svn history is invisible (as text is white)
- LayDes .usc: Small defect in slider thumb in SD mode
- Laydes Rect is still to aggresive
NTH:

View file

@ -450,7 +450,7 @@ void ChSynthetic(Image *button100x100, Color *text, bool macos)
s.left[i] = MakeButton(roundness, m2, lw, ink, CORNER_TOP_LEFT|CORNER_BOTTOM_LEFT);
s.trivial[i] = s.look[i] = s.right[i] = MakeButton(roundness, m2, lw, ink, CORNER_TOP_RIGHT|CORNER_BOTTOM_RIGHT);
if(i == 0)
s.coloredge = WithHotSpots(MakeButton(roundness, Black(), macos ? lw : DPI(2), Null), DPI(3), lw, 0, 0);
s.coloredge = WithHotSpots(MakeButton(roundness, Black(), DPI(2), Null), DPI(3), lw, 0, 0);
auto Middle = [&](Image m) {
ImageBuffer ib(m);
for(int y = 0; y < lw; y++)

View file

@ -479,10 +479,6 @@ void ActiveEdgeFrame::FramePaint(Draw& w, const Rect& r)
: CTRL_NORMAL;
}
ChPaintEdge(w, r, edge[i]);
// if(i == CTRL_DISABLED) {
// DLOG(!IsNull(coloredge) << " " << color);
// ASSERT(color.GetR() != 255);
// }
if(!IsNull(coloredge))
ChPaintEdge(w, r, coloredge, color);
}

View file

@ -152,7 +152,7 @@ void StdDisplayClass::Paint0(Draw& w, const Rect& r, const Value& q,
x = r.right - tsz.cx;
if(a == ALIGN_CENTER)
x += (width - tsz.cx) / 2;
int tcy = GetTLTextHeight(txt, font);
int tcy = tsz.cy;
int tt = r.top + (tcy < 4 * r.GetHeight() / 3 ? (r.Height() - tcy) / 2 : 0); // allow negative tt if only slightly bigger
if(tsz.cx > width) {
Size isz = DrawImg::threedots().GetSize();

View file

@ -41,7 +41,7 @@ void DrawTextEllipsis(Draw& w, int x, int y, int cx, const char *text, const cha
Size GetTLTextSize(const wchar *text, Font font)
{
Size sz(0, 0);
int cy = font.Info().GetHeight();
int cy = font.GetCy();
const wchar *s = text;
const wchar *t = s;
for(;;) {
@ -70,19 +70,12 @@ Size GetTLTextSize(const wchar *text, Font font)
int GetTLTextHeight(const wchar *s, Font font)
{
int cy = font.Info().GetHeight();
int h = cy;
while(*s) {
if(*s == '\n')
h += cy;
s++;
}
return h;
return GetTLTextSize(s, font).cy;
}
void DrawTLText(Draw& draw, int x, int y, int cx, const wchar *text,
Font font, Color ink, int accesskey) {
int cy = font.Info().GetHeight();
int cy = font.GetCy(); // Bold to have the same height as with GetStdFontCy()
const wchar *s = text;
const wchar *t = s;
int apos = HIWORD(accesskey);

View file

@ -117,7 +117,7 @@ int Font::FindFaceNameIndex(const String& name) {
void Font::SyncStdFont()
{
Mutex::Lock __(sFontLock);
StdFontSize = Size(AStdFont.GetAveWidth(), AStdFont().Bold().GetCy());
StdFontSize = Size(AStdFont.GetAveWidth(), AStdFont().GetCy());
LLOG("SyncStdFont " << StdFontSize);
SyncUHDMode();
}