-
Notifications
You must be signed in to change notification settings - Fork 366
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
Dot in li element is not in the middle #478
Comments
hi @mndzielski , I'll have a look |
@danfickle @syjer |
hi @mndzielski currently not, I was side tracked on other stuff, but I'll have look in this period. |
Currently trying to understand the issue of vertical positioning: looking at the code in int y = getReferenceBaseline(c, box) - (int)strutMetrics.getAscent() / 2 - marker.getDiameter() / 2; seems to skew a little bit too much on the top. Adding some code to visualize it: c.getOutputDevice().drawDebugOutline(c, box, FSRGBColor.GREEN);
c.getOutputDevice().setColor(FSRGBColor.RED);
c.getOutputDevice().drawRect(x, getReferenceBaseline(c, box), 1000, 1);
c.getOutputDevice().setColor(FSRGBColor.BLUE);
c.getOutputDevice().drawRect(x, getReferenceBaseline(c, box) - (int)strutMetrics.getAscent(), 1000, 1); We can see the issue of the vertical positioning: Basically, we center exactly with the full line height, which is visually not exactly correct. |
For the horizontal alignement: if (style.getDirection() == IdentValue.LTR) {
x += -marker.getLayoutWidth() + marker.getDiameter();
} Adding |
doing this in if (style.getDirection() == IdentValue.LTR) {
x += -marker.getLayoutWidth() + marker.getDiameter();
}
if (style.getDirection() == IdentValue.RTL){
x += box.getMarkerData().getReferenceLine().getWidth() + marker.getLayoutWidth();
}
//
c.getOutputDevice().drawDebugOutline(c, box, FSRGBColor.GREEN);
c.getOutputDevice().setColor(FSRGBColor.RED);
c.getOutputDevice().drawRect(x, getReferenceBaseline(c, box), 1000, 1);
c.getOutputDevice().setColor(FSRGBColor.BLUE);
int bottomLine = getReferenceBaseline(c, box);
int top = bottomLine - (int) (strutMetrics.getAscent() / 1.5);
c.getOutputDevice().drawRect(x, top, 1000, 1);
//
c.getOutputDevice().setColor(new FSRGBColor(255, 255, 0));
c.getOutputDevice().drawRect(x, bottomLine - (bottomLine-top)/2, 1000, 1);
//
c.getOutputDevice().setColor(FSRGBColor.BLACK);
int y = bottomLine - (bottomLine-top) /2 - marker.getDiameter() / 2 ; Using 1.5 as a criteria for finding the "top" of the line does not seems to bad as a heuristic. which is quite decent. l'll need to test with the RTL and look if there are any corner case. WDYT @danfickle ? (looking at the failing tests, the placement of the disc seems to be a little better now: after: ) |
@syjer, I'm happy to go with your judgement on this one. It does look better with your heuristic. I'm sure you're well ahead of me, but remember to test(at least informally) with at least a couple of fonts and font sizes. Thanks again. |
@danfickle yes, I'm currently looking at the RTL case (and adding some fine tuning for the x positioning for the LTR one) I've noticed that the list (ul, ol) in chrome&co have a css property "padding-inline-start: 40px" which, in function if it's a LTR or RTL case, will add the necessary padding on the right or left. As far as I've noticed, we don't really support this property, as we define in our default css:
Which work really well for LTR, but clearly not for RTL. So I'm wondering if I should fix first the LTR case and submit the PR, and then try to tackle the RTL one which seems more complex, as we need to support a new css property. |
#478 change list decoration placement logic
Hi,
I'd like to report that dot in li element is align to top. In browser is align to middle. It's quite annoying.
Another issue is fact that dot is not fully rendering when font-size is large.
HTML example:
And result:
The text was updated successfully, but these errors were encountered: