- if (!width_.empty()) {
- LyXLength len(width_);
- switch(len.unit()) {
- case LyXLength::PW: // Always % of workarea
- case LyXLength::PE:
- case LyXLength::PP:
- case LyXLength::PL:
- return (InsetCollapsable::getMaxWidth(bv, inset) * (int)len.value()) / 100;
- default:
- {
- int ww1 = VSpace(width_).inPixels(bv);
- int ww2 = InsetCollapsable::getMaxWidth(bv, inset);
- if (ww2 > 0 && ww2 < ww1) {
- return ww2;
- }
- return ww1;
- }
+ if (!width_.zero()) {
+ int ww1 = latexTextWidth(bv);
+ int ww2 = InsetCollapsable::getMaxWidth(bv, inset);
+ if (ww2 > 0 && ww2 < ww1) {
+ return ww2;