Re: [csswg-drafts] [css-images][css-values][css-gcpm] qrcode() for generating QR code images from URLs (#6544)

There's no need to make a generic function that smuggles the details in arguments, when the syntax of what's allowed might vary based on that argument. We're not exactly pressed for function names, so we can just give functions the maximally useful name to start with, and then give them the correct specialized syntax based on that. In 20 years we can add an `azteccode()` function alongside `qrcode()`, that's fine.

Thanks for the description of what needs to be controllable for QR codes, btw - that's what I was missing to make this a proper proposal. So we're looking at a grammar like:

```
<qrcode()> = qrcode( <string> | <url>] 
                     [ [ low-ecc | medium-ecc | high-ecc ] 
                       || [ unit [ auto | <length> ] ]
                       || [ version [ auto | <integer [1, 40]> ] ]
                     ]
                   )
```

* If a `<url>` is specified, it's absolutized and serialized, then treated identically to a `<string>` argument.
* If `unit auto` is specified (the default when omitted), the image has no natural width or height, only a 1/1 natural aspect ratio; if it's provided with a length, the image has an appropriate natural size determined by that unit size.
* If `version auto` is specified (the default when omitted), the image uses the minimum version to allow it to display the data; otherwise it uses the specified version, truncating the data if necessary.
* If the *-ecc keyword is omitted, we default to ???.

-----

Some further questions:

* I presume we can automatically determine the encoding mode based on the data; if all numeric, we use the numeric encoder, etc. 
* What about the "Structured Append" mode? That seems like a lot more complexity to build into the syntax.
* Should we worry about MicroQR? It looks like it's extremely similar?
* Should we add a (controllable) padding? You can use CSS padding when using the QR code in `content`, but not when using it as a background-image, and I presume there's a reasonably standard padding region suggested by the specs to ensure proper reading.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6544#issuecomment-964469206 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 9 November 2021 19:32:10 UTC