Giter Club home page Giter Club logo

Comments (2)

Iaenhaall avatar Iaenhaall commented on June 2, 2024

Thank you for the feedback and the research. I will try to investigate the problem and fix it as soon as I have some free time.

from attributedtext.

LukasHakulin avatar LukasHakulin commented on June 2, 2024

Hi guys!
I'm just looking for some simple html formatting solution with iOS 14 support (I'm new in swiftUI world) and I discover this library.
Unlikely I'm not able to use it for my purposes, but I spend a couple of hours playing with it and also checked known issues (just for sure :D).
I think what are you describing here isn't bug, it's just problem of your test, you are modifying results and this is the real reason why it's not working.
Try that again, but "simpler":

struct ContentView: View {

    var body: some View {
        VStack(spacing: 20) {
            Group {
                Text("bold, italic, underline")
                    .fontWeight(.bold)
                    .italic()
                    .underline()
            }.background(Color.green)
            Group {
                Divider()
                Text("bold, italic, underline")
                    .bold()
                    .italic()
                    .underline()
                    .font(.system(size: 20))
                Text("bold, underline, italic")
                    .bold()
                    .underline()
                    .italic()
                    .font(.system(size: 20))
            }
            .padding(8)
            Group {
                Divider()
                Text("bold, italic, underline")
                    .fontWeight(.bold)
                    .italic()
                    .underline()
                    .font(.system(size: 20))
                Text("bold, underline, italic")
                    .fontWeight(.bold)
                    .underline()
                    .italic()
                    .font(.system(size: 20))
                Divider()
                Text("italic, bold, underline")
                    .italic()
                    .fontWeight(.bold)
                    .underline()
                    .font(.system(size: 20))
                Text("italic, underline, bold")
                    .italic()
                    .underline()
                    .fontWeight(.bold)
                    .font(.system(size: 20))
                Divider()
                Text("underline, bold, italic")
                    .underline()
                    .fontWeight(.bold)
                    .italic()
                    .font(.system(size: 20))
                Text("underline, italic, bold")
                    .underline()
                    .italic()
                    .fontWeight(.bold)
                    .font(.system(size: 20))
            }
        }
        .padding()
    }
}

Screen Shot 2023-04-16 at 12 11 15

From my point of view it looks like you have modified the result with application of Font on Group with tested data(Text) in combination with using .bold() instead of .fontWeight(.bold) cause this is the real implementation of <b> tag in library.
Probably the easiest way to fix it is use .bold() as modifier.

Because ordering of modifiers matter, it's up to programmer to choose well to avoid formatting issues... or wait to iOS 15 and use AttributedString or some other solution ¯_(ツ)_/¯

from attributedtext.

Related Issues (5)

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.