{"action":"created","issue":{"url":"https://api.github.com/repos/johanmattssonm/birdfont/issues/6","labels_url":"https://api.github.com/repos/johanmattssonm/birdfont/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/johanmattssonm/birdfont/issues/6/comments","events_url":"https://api.github.com/repos/johanmattssonm/birdfont/issues/6/events","html_url":"https://github.com/johanmattssonm/birdfont/issues/6","id":99313952,"number":6,"title":"Exported font seems to have wrong ascent/descent","user":{"login":"weeble","id":663664,"avatar_url":"https://avatars.githubusercontent.com/u/663664?v=3","gravatar_id":"","url":"https://api.github.com/users/weeble","html_url":"https://github.com/weeble","followers_url":"https://api.github.com/users/weeble/followers","following_url":"https://api.github.com/users/weeble/following{/other_user}","gists_url":"https://api.github.com/users/weeble/gists{/gist_id}","starred_url":"https://api.github.com/users/weeble/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weeble/subscriptions","organizations_url":"https://api.github.com/users/weeble/orgs","repos_url":"https://api.github.com/users/weeble/repos","events_url":"https://api.github.com/users/weeble/events{/privacy}","received_events_url":"https://api.github.com/users/weeble/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-05T22:34:03Z","updated_at":"2015-08-07T10:49:18Z","closed_at":null,"body":"When I export this font as ttf/mac ttf, it seems to get different values for the ascent and descent from what I'd expect. The main symptom is that when the font is used, while it sits correctly on the baseline with other text, selecting the text results in a large area selected above the font while below the selection does not extend to the bottom of the descenders.\r\n\r\nHere's the letter \"p\" in the font. The visible horizontal lines, from top to bottom, are \"top margin\", \"top\", \"height\", \"x-height\", \"baseline\", \"bottom\" and \"bottom margin\". Both \"bottom\" and \"bottom margin\" fall at or below the tail of the \"p\".\r\n\r\n![screen shot 2015-08-05 at 22 47 20](https://cloud.githubusercontent.com/assets/663664/9099440/91a5d4e0-3bc8-11e5-9591-837253c234d3.png)\r\n\r\nHere's what it looks like when the font is exported as ttf:\r\n\r\n<img width=\"512\" alt=\"screen shot 2015-08-05 at 22 44 01\" src=\"https://cloud.githubusercontent.com/assets/663664/9099484/ec1d4c64-3bc8-11e5-886e-6a807068da4d.png\">\r\n\r\nAs you can see, when the text is selected, the selection does not extend all the way to the bottom of the \"p\", while it extends quite some distance over the top. When the font is used in other programs it sometimes gets cut off at the bottom.\r\n\r\nHere's a complete bf file:\r\n\r\nhttps://gist.github.com/weeble/068287e0bbad8dd9c66e\r\n\r\nThis doesn't seem to happen in every font. I think it might be related to font/horizontal/base_line being non-zero, but I haven't really done enough experiments to be sure. "},"comment":{"url":"https://api.github.com/repos/johanmattssonm/birdfont/issues/comments/128671389","html_url":"https://github.com/johanmattssonm/birdfont/issues/6#issuecomment-128671389","issue_url":"https://api.github.com/repos/johanmattssonm/birdfont/issues/6","id":128671389,"user":{"login":"weeble","id":663664,"avatar_url":"https://avatars.githubusercontent.com/u/663664?v=3","gravatar_id":"","url":"https://api.github.com/users/weeble","html_url":"https://github.com/weeble","followers_url":"https://api.github.com/users/weeble/followers","following_url":"https://api.github.com/users/weeble/following{/other_user}","gists_url":"https://api.github.com/users/weeble/gists{/gist_id}","starred_url":"https://api.github.com/users/weeble/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weeble/subscriptions","organizations_url":"https://api.github.com/users/weeble/orgs","repos_url":"https://api.github.com/users/weeble/repos","events_url":"https://api.github.com/users/weeble/events{/privacy}","received_events_url":"https://api.github.com/users/weeble/received_events","type":"User","site_admin":false},"created_at":"2015-08-07T10:49:18Z","updated_at":"2015-08-07T10:49:18Z","body":"I had a look at this last night. I'm still trying to set up a Ubuntu VM to build the source myself, but I think the issue is probably here in HheaTable:\r\n\r\nhttps://github.com/johanmattssonm/birdfont/blob/master/libbirdfont/OpenFontFormat/HheaTable.vala#L93\r\n\r\nIt calculates `ascender` and `descender` based on `font.top_limit`, but doesn't adjust for `font.base_line`. In contrast, in GlyfData, y values are adjusted based on `font.base_line`:\r\n\r\nhttps://github.com/johanmattssonm/birdfont/blob/master/libbirdfont/OpenFontFormat/GlyfData.vala#L244\r\n\r\nIf my understanding of `base_line` is correct, then it should be accounted for in both these places. If I manage to build BirdFont over the weekend I'll try out a fix."}}