bool standalone_;
binding<std::wstring> text_;
std::shared_ptr<void> text_subscription_;
+ binding<int> current_bearing_y_;
+ binding<int> current_protrude_under_y_;
draw_frame frame_;
text::texture_atlas atlas_;
text::texture_font font_;
this->constraints_.width.set(metrics.width);
this->constraints_.height.set(metrics.height);
+ current_bearing_y_.set(metrics.bearingY);
+ current_protrude_under_y_.set(metrics.protrudeUnderY);
frame_ = core::draw_frame(std::move(frame));
}
{
return text_;
}
+
+ const binding<int>& current_bearing_y() const
+ {
+ return current_bearing_y_;
+ }
+
+ const binding<int>& current_protrude_under_y() const
+ {
+ return current_protrude_under_y_;
+ }
std::wstring print() const
{
void text_producer::subscribe(const monitor::observable::observer_ptr& o) {}
void text_producer::unsubscribe(const monitor::observable::observer_ptr& o) {}
binding<std::wstring>& text_producer::text() { return impl_->text(); }
+const binding<int>& text_producer::current_bearing_y() const { return impl_->current_bearing_y(); }
+const binding<int>& text_producer::current_protrude_under_y() const { return impl_->current_protrude_under_y(); }
spl::shared_ptr<text_producer> text_producer::create(const spl::shared_ptr<frame_factory>& frame_factory, int x, int y, const std::wstring& str, const text::text_info& text_info, long parent_width, long parent_height, bool standalone)
{
void unsubscribe(const monitor::observable::observer_ptr& o) override;
binding<std::wstring>& text();
+ const binding<int>& current_bearing_y() const;
+ const binding<int>& current_protrude_under_y() const;
private:
struct impl;
spl::unique_ptr<impl> impl_;
float pos_y = (float)y;
int maxBearingY = 0;
+ int maxProtrudeUnderY = 0;
int maxHeight = 0;
auto end = str.end();
result[index*16 + 15] = coords.bottom; //texcoord.s
int bearingY = face_->glyph->metrics.horiBearingY >> 6;
+
if(bearingY > maxBearingY)
maxBearingY = bearingY;
- if(coords.height > maxHeight)
- maxHeight = coords.height;
+ int protrudeUnderY = coords.height - bearingY;
+
+ if (protrudeUnderY > maxProtrudeUnderY)
+ maxProtrudeUnderY = protrudeUnderY;
+
+ if (maxBearingY + maxProtrudeUnderY > maxHeight)
+ maxHeight = maxBearingY + maxProtrudeUnderY;
pos_x += face_->glyph->advance.x / 64.0f;
previous = glyph_index;
metrics->width = (int)(pos_x - x + 0.5f);
metrics->bearingY = maxBearingY;
metrics->height = maxHeight;
+ metrics->protrudeUnderY = maxProtrudeUnderY;
}
return result;
}