New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New text tool #4383
base: beta
Are you sure you want to change the base?
New text tool #4383
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
} | ||
|
||
std::string faceValue() const { | ||
return m_face; | ||
FontInfo fontInfo() const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: method 'fontInfo' can be made static [readability-convert-member-functions-to-static]
FontInfo fontInfo() const { | |
static FontInfo fontInfo() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a bug in clang-tidy.
src/app/ui/font_entry.cpp
Outdated
case kFocusEnterMessage: | ||
if (!m_popup) { | ||
try { | ||
FontInfo info = static_cast<FontEntry*>(parent())->info(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'info' of type 'FontInfo' can be declared 'const' [misc-const-correctness]
FontInfo info = static_cast<FontEntry*>(parent())->info(); | |
FontInfo const info = static_cast<FontEntry*>(parent())->info(); |
font->setSize(fontInfo.size()); | ||
} | ||
else { | ||
const int size = (fontInfo.useDefaultSize() ? 18: fontInfo.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'float' to 'int' [bugprone-narrowing-conversions]
const int size = (fontInfo.useDefaultSize() ? 18: fontInfo.size());
^
if (bounds.w < 1) bounds.w = 1; | ||
if (bounds.h < 1) bounds.h = 1; | ||
|
||
image.reset(doc::Image::create(doc::IMAGE_RGB, bounds.w, bounds.h)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'float' to 'int' [bugprone-narrowing-conversions]
image.reset(doc::Image::create(doc::IMAGE_RGB, bounds.w, bounds.h));
^
if (bounds.w < 1) bounds.w = 1; | ||
if (bounds.h < 1) bounds.h = 1; | ||
|
||
image.reset(doc::Image::create(doc::IMAGE_RGB, bounds.w, bounds.h)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'float' to 'int' [bugprone-narrowing-conversions]
image.reset(doc::Image::create(doc::IMAGE_RGB, bounds.w, bounds.h));
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
src/app/util/render_text.cpp
Outdated
|
||
for (int i=0; i<info.glyphCount; ++i) { | ||
auto rc = info.getGlyphBounds(i); | ||
m_bounds |= gfx::Rect(rc.x, 0, rc.w, height); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'float' to 'int' [bugprone-narrowing-conversions]
m_bounds |= gfx::Rect(rc.x, 0, rc.w, height);
^
src/app/util/render_text.cpp
Outdated
|
||
for (int i=0; i<info.glyphCount; ++i) { | ||
auto rc = info.getGlyphBounds(i); | ||
m_bounds |= gfx::Rect(rc.x, 0, rc.w, height); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'float' to 'int' [bugprone-narrowing-conversions]
m_bounds |= gfx::Rect(rc.x, 0, rc.w, height);
^
src/app/util/render_text.cpp
Outdated
|
||
for (int i=0; i<info.glyphCount; ++i) { | ||
auto rc = info.getGlyphBounds(i); | ||
m_bounds |= gfx::Rect(rc.x, 0, rc.w, height); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'float' to 'int' [bugprone-narrowing-conversions]
m_bounds |= gfx::Rect(rc.x, 0, rc.w, height);
^
This new font selector list installed fonts with its proper name. It needs some extra work yet to select font set styles (regular, bold, italic, etc.)
If we clicked bold/italic, and then choose another font family, we were using the cached typeface inside the FontInfo instead of an update typeface with the selected styles applied (bold/italic). Now we don't cache the typeface inside FontInfo to avoid this.
…t run This fixes the required output image size to render text in different languages when the text does't support the full range of the specified chars/code points.
A work-in-progress to convert the "insert text" command into an interactive "text tool."