discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: Jan Stary <hans@stare.cz>
Cc: discuss@mdocml.bsd.lv
Subject: Re: Links into HTML page would be great
Date: Tue, 14 Mar 2017 02:49:43 +0100	[thread overview]
Message-ID: <20170314014943.GB18242@athene.usta.de> (raw)
In-Reply-To: <20170313095627.GA97043@www.stare.cz>

Hi Jan,

Jan Stary wrote on Mon, Mar 13, 2017 at 10:56:27AM +0100:

> Anyway, in my firefox,
> http://man.openbsd.org/OpenBSD-current/man5/ssh_config.5
> displays the synopsis as
> 
> SYNOPSIS
>   ~/.ssh
>   /config 	
> 
>   /etc/ssh
>   /ssh_config 	
> 
> 
> Only after I make the font smaller than 100% (with Crtrl + -) it becomes
> 
> SYNOPSIS
>   ~/.ssh/config 	
>   /etc/ssh/ssh_config
> 
> Why is that? Could it be besause of the hardwired width?

Yes.

> (Or is it a firefox bug to not recompute the relative widths (ex)?)

No, it is a bug in mandoc, not in firefox.

> <h1 class="Sh" id="SYNOPSIS">SYNOPSIS</h1>
> <table class="Nm">
>   <colgroup>
>     <col style="width: 13.00ex;"/>

At this point, we still have "font-weight: normal;".
So the column width is (about) 13 normal-weight characters.

>     <col/>
>   </colgroup>
>   <tr>
>     <td><b class="Nm">~/.ssh/config</b></td>

But here, we print 13 bold characters.
They don't fit and get wrapped.

> In lynx it displays fine.

Yes, the above is generally no problem width fixed-width fonts.
In mandoc -Tascii and mandoc -Tutf8, it also works fine.

Similar issues might exist in PostScript and PDF, but i'll
treat that as a different story for now.

Thanks for mentioning this,
  Ingo


Log Message:
-----------
Slightly increase widths calculated from string lengths (mainly 
for .Bl -tag lists and SYNOPSIS .Nm blocks), such that the text
still fits even if it is printed in bold font.  
This is an ugly band aid - but implementing font-dependent width
measurements would be a major project and even more difficult 
for HTML than for PostScript.

Issue reported by Jan Stary <hans at stare dot cz>.

Modified Files:
--------------
    mdocml:
        html.c
        mdoc_html.c

Revision Data
-------------
Index: html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/html.c,v
retrieving revision 1.208
retrieving revision 1.209
diff -Lhtml.c -Lhtml.c -u -p -r1.208 -r1.209
--- html.c
+++ html.c
@@ -591,6 +591,8 @@ print_otag(struct html *h, enum htmltag 
 				break;
 			su = &mysu;
 			a2width(arg2, su);
+			/* Increase width to make even bold text fit. */
+			su->scale *= 1.1;
 			if (fmt[-1] == 'W')
 				su->scale *= -1.0;
 			break;
Index: mdoc_html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_html.c,v
retrieving revision 1.275
retrieving revision 1.276
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.275 -r1.276
--- mdoc_html.c
+++ mdoc_html.c
@@ -628,7 +628,8 @@ mdoc_nm_pre(MDOC_ARGS)
 		len = html_strlen(meta->name);
 
 	t = print_otag(h, TAG_COLGROUP, "");
-	print_otag(h, TAG_COL, "shw", len);
+	/* Increase width to make even bold text fit. */
+	print_otag(h, TAG_COL, "shw", len + 2);
 	print_otag(h, TAG_COL, "");
 	print_tagq(h, t);
 	print_otag(h, TAG_TR, "");
--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

  reply	other threads:[~2017-03-14  1:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28 14:33 Thomas Güttler
2017-03-12 18:08 ` Ingo Schwarze
2017-03-12 19:39   ` Ingo Schwarze
2017-03-13  9:42     ` Thomas Güttler
2017-03-13  9:56       ` Jan Stary
2017-03-14  1:49         ` Ingo Schwarze [this message]
2017-03-14  9:39         ` Jan Stary
2017-03-14 17:17           ` Ingo Schwarze
2017-03-13  9:59       ` Thomas Güttler
2017-03-13 15:32         ` Ingo Schwarze
2017-03-13 21:35       ` Ingo Schwarze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170314014943.GB18242@athene.usta.de \
    --to=schwarze@usta.de \
    --cc=discuss@mdocml.bsd.lv \
    --cc=hans@stare.cz \
    --subject='Re: Links into HTML page would be great' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).