Skip to content

Add support for circular flag rendering #5

@Jutier

Description

@Jutier

At the moment, if I want to render a flag as a circle (maybe it's too niche), there isn't a global or consistent solution because the aspect ratio of flags isn't constant. This becomes particularly problematic when dealing with flags that require specific adjustments for centering or clipping.

I believe it would be better to implement this feature on an individual basis for each flag, as centering isn't always the best approach for certain designs. By doing this, we would also be exposed to the width and height variables.

Here's an example of how this could be implemented:

// br 7:10
- #let flag-br(height:.65em) = {
+ #let flag-br(height:.65em, circle: false) = {
    box(
+    // I'm only using it with clip, most of those properties should be unset if circle == false
+    clip: circle,
+    radius: 50%,
+    width: height,
+    height: height,
+    // Usually this should be (width - height)/2
+    inset: (left: -(3/14)*height),
      rect(height:height, width:10/7*height, fill:rgb("00923e"))
      + place(
        polygon(
          fill:rgb("ffcb00"),
          ((1.7/20)*height*10/7,(height/-2)),
          ((1/2)*height*10/7,-(14-1.7)/14*height),
          (((20-1.7)/20)*height*10/7,(height/-2)),
          ((1/2)*height*10/7,-1.7/14*height),
          )
      )
      + place(
          dy:-3/4*height,
          dx:(10/7/2-1/4)*height,
          image("coat of arms/BR.svg", height:height/2))
    )
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions