Coder Social home page Coder Social logo

Comments (10)

dm-p avatar dm-p commented on May 28, 2024 1

The Segoe family behaviour inside custom visuals is pretty weird. Segoe UI Bold and Segoe UI Semibold are not named font families available to the visual sandbox, so naming them as per the font property dropdowns doesn't work the same. You would need to apply the appropriate font-weight to them within a custom visual. The following will work:

Segoe UI Bold

Measure = 
    VAR CSS = "
            <style>
                .test {
                    font-family: ""Segoe UI"", helvetica, arial, sans-serif;
                    font-weight: bold;
                    font-size: 40px;
                    color: #ADCDE9;
                }
                
            </style>"

RETURN
CSS&
"<span class='test'>My Test</span>"

image

Segoe UI Semibold

Measure = 
    VAR CSS = "
            <style>
                .test {
                    font-family: ""Segoe UI"", helvetica, arial, sans-serif;
                    font-weight: 600;
                    font-size: 40px;
                    color: #ADCDE9;
                }
                
            </style>"

RETURN
CSS&
"<span class='test'>My Test</span>"

image


DIN isn't passed to the visual sandbox as a valid font. In Deneb we have actually packaged the DIN font as a base64 asset that we can load and therefore access. TBH I'm surprised I haven't done this with HTML Content. I'm not currently planning any more releases, but I can try to find some time to do a minor release with these changes.

from powerbi-visuals-html-content.

PBI-David avatar PBI-David commented on May 28, 2024 1

Can I reopen this as a reminder to package DIN in the next release? This visual is useful for building KPIs and DIN is a standard font for that. Thanks

from powerbi-visuals-html-content.

dm-p avatar dm-p commented on May 28, 2024 1

I have to submit a bug fix release for iframes not working, so I'll add DIN to this build as well before I submit.

from powerbi-visuals-html-content.

dm-p avatar dm-p commented on May 28, 2024 1

1.4.1 has been submitted to AppSource. When this goes live, you will be able to specify either din or wf_standard-font as a font family to use DIN inside the visual.

html-content-issue-95-resolution.mp4

from powerbi-visuals-html-content.

PBI-David avatar PBI-David commented on May 28, 2024

Thanks Daniel. Just an FYI, that applying a font-weight of bold to Segoe UI does not render the same as Segoe (Bold). They're different fonts. Segoe (Bold) is a lot more elegant looking as you can see below. I also seem to get different results to you. 2 and 3 below look identical to me.

  1. Standard text box Segoe (Bold) 32

  2. .test {
    font-family: ""Segoe UI"", helvetica, arial, sans-serif;
    font-weight: bold;
    font-size: 40px;
    color: #ADCDE9;
    }

  3. .test {
    font-family: ""Segoe UI"", helvetica, arial, sans-serif;
    font-weight: 600;
    font-size: 40px;
    color: #ADCDE9;
    }

image

Font Test.pbix,zip

from powerbi-visuals-html-content.

dm-p avatar dm-p commented on May 28, 2024

In June 2019, MS standardised font size to points rather than pixels, which will be a contributing reason for why they look inconsistent here.

Here's a text box with Segoe (Bold) 32pt (top), and then HTML Content with the title styled the same (Segoe UI Bold, 32). The title is outside the sandbox, so should be the same as the text box. Underneath the title divider is the HTML Content body, with the measure as configured previously, but modified to 32pt for font-size.

image

For transparency, measure is as follows:

Measure = 
    VAR CSS = "
            <style>
                .test {
                    font-family: ""Segoe UI"", helvetica, arial, sans-serif;
                    font-weight: 700;
                    font-size: 32pt;
                    color: #000;
                }
                
            </style>"

RETURN
CSS&
"<span class='test'>My Test</span>"

This is HTML Content 1.4 (AppSource version) inside Power BI Desktop (Aug 2023)

As far as I can tell, these look the same across all three instances, although I wear glasses and am approaching middle age ;)

Unfortunately, MS doesn't provide Segoe UI Semibold in the text box as an option, so I can't repeat the test fully, but here's the title and body test repeated:

image

Modifying your workbook with the font size changes also looks right (to me):

image

...but have attached for your reference.

Font.Test.pbix.zip

If you see differences between the text box and visual title, this is an MS issue. Anything that applies to the visual container is not available to visual developers and Power BI takes care of it.

If HTML Content's body looks different to its title, then we will need to have a look at potentially embedding those fonts, although MS doesn't permit them to be converted for embedding, so I'll have to progress this with them somehow.

from powerbi-visuals-html-content.

PBI-David avatar PBI-David commented on May 28, 2024

How bizarre - I still don't see what you see. I have tested on two completely different machines and I get consistent results on both.

image

The image above still has different fonts and I checked on two machines.

  1. is the text box
    image

  2. is the HTML 1.4 with a title and html content which should all look identical. The title is identical to the text box but the html still renders much chunkier

image


Measure2 = 
    VAR CSS = "
            <style>
                .test {
                    font-family: ""Segoe UI"", helvetica, arial, sans-serif;
                    font-weight: 700;
                    font-size: 32pt;
                    color: #ADCDE9;
                }
                
            </style>"

RETURN
CSS&
"<span class='test'>Here is a test</span>"

Opening your workbook with zero modifications shows me this:

image

The service shows me the same.

from powerbi-visuals-html-content.

PBI-David avatar PBI-David commented on May 28, 2024

To be super explicit:

This title is Segoe UI with a bold modifier and renders the same as the HTML content (quite chunky)

image

This title is Segoe UI Bold (no bold modifier) and renders much thinner than the HTML content
image

I think Segoe UI Bold is its font that may need to be packaged with DIN although I can't explain why you see something different with the exact same code.

from powerbi-visuals-html-content.

dm-p avatar dm-p commented on May 28, 2024

Here's how it looks like the Service for me:

image

I've tried this on 2 different machines (both on Win 11), 2 different versions of Power BI Desktop, 3 different tenants and both AppSource editions of HTML Content (regular and certified), just to be sure.

At this point, I'm genuinely stumped, so we may need more information to come through before I can progress any further.

from powerbi-visuals-html-content.

PBI-David avatar PBI-David commented on May 28, 2024

Thanks for checking. It is bizarre that we're seeing different things but I agree without more information then nothing can be done from your side. I'll close for now and reopen if anything else occurs to me.

from powerbi-visuals-html-content.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.