Select to view content in your preferred language

font-weight doesn't work in graphicLayer😥

988
4
Jump to solution
01-06-2022 01:50 AM
ZhouYC
by
Emerging Contributor
graphics.push({
            attributes: {
              'name': item.name
            },
            geometry: {
              type: 'point',
              x: item.x,
              y: item.y,
              spatialReference: GlobalMap.getMapView().spatialReference
            },
            symbol: {
              type: "text",
              text: 'ccc',
              yoffset: '20px',
              color: '#50E3C2',
              font: {
                size: 12 /* work */
                weight: "bold"  /* doesn't work */
              }
            }
          })
 
this.graphicsLayer.addMany(graphics)
0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi there,

Are you using 4.22 version of the js api? We have an issue where the text symbols are not honoring the bolded fonts. This issue will be fixed in our next release. However, the font size and weight will be honored without issues if font family is specified as @Noah-Sager pointed out. 

This test app uses version 4.22 and you can see that font weight and sizes being honored. https://codepen.io/U_B_U/pen/XWWJwxq?editors=1000

 

At 4.23, your code should work as expected.

 

View solution in original post

4 Replies
Noah-Sager
Esri Regular Contributor

Does it work if you add a valid font family? I assume that's the missing piece.

font: {
     family: "arial",
     size: 12 
      weight: "bold"  
}
 
 
ZhouYC
by
Emerging Contributor

Yes, if i add font family, it's worked.

Thank you for your answer!

UndralBatsukh
Esri Regular Contributor

Hi there,

Are you using 4.22 version of the js api? We have an issue where the text symbols are not honoring the bolded fonts. This issue will be fixed in our next release. However, the font size and weight will be honored without issues if font family is specified as @Noah-Sager pointed out. 

This test app uses version 4.22 and you can see that font weight and sizes being honored. https://codepen.io/U_B_U/pen/XWWJwxq?editors=1000

 

At 4.23, your code should work as expected.

 

ZhouYC
by
Emerging Contributor

Yes, if i add font family, it's worked.

Thank you for your answer!

0 Kudos