Skip to main content

A matching development SDK with commonLineSymbols also supports shared planar line symbols, including true per-glyph curved geometry, target ownership, joint icon/text groups and shared budgets. Earlier point-only scope and pending line-symbol notes below are superseded for this bounded subset. Complex shaping, tilted/globe/terrain placement and complete road stitching remain pending.

Shared point text labels

Standard planar symbol layers now draw Latin/Chinese text on Point/MultiPoint/MVT points. text-field accepts a string or common string expression. text-size accepts0..256 CSS pixels or a common numeric expression,default16. text-anchor supports nine anchors,default center;text-offset uses two em values and text-rotate accepts-360..360 degrees or a common numeric expression. text-color/text-opacity support common attribute,state and zoom paint expressions. Text overlap/ignore options default false and padding defaults2. Whole labels participate in common collision/order;queries inspect placed label rectangles. Image/text combinations share a layer with joint-symbols placement.

import {map} from 'sqsmap';
map.addSource('points',{type:'geojson',data:{type:'Feature',id:1,
 properties:{name:'Sqs地图'},geometry:{type:'Point',coordinates:[0,0]}}});
map.addLayer({id:'labels',type:'symbol',source:'points',layout:{
 'text-field':['get','name'],'text-size':18,'text-anchor':'center'
},paint:{'text-color':'#ff0000','text-opacity':1}});
await map.sqs.flush({render:true});
map.setLayoutProperty('labels','text-offset',[1,0]);
map.setPaintProperty('labels','text-color','#00ff00');
await map.sqs.flush({render:true});

Existing glyph shaping and bundled HarmonyOS Sans SC provide the same actual font on native/WASM (24px glyphs,SDF boundary near192/255). text-font retains1..8 ordered family names,and external glyph services provide actual glyphs; without a service, the documented bundled fallback is used. Complex shaping,additional text properties,line placement and3D/raster composition remain pending; joint image/text placement is connected. Unsupported bundled glyphs reject explicitly and preserve the previous layer. Control language is independent from data text/font.

A separate R8 atlas preserves the user image atlas and registration budget. Glyphs add no listImages entries or fake sources. Limits are256 characters/4096bytes per label,16K common symbol points,65536 glyph quads,and8192 distinct glyphs subject also to the2048 atlas capacity. Hidden caches count. Glyph caches are reused;size,rotation,anchor/offset,source/state and real viewport/density changes refresh shared placement. Color alpha and opacity combine once;zero final alpha has no hit. The initial08.12 fixed typography is superseded by the08.13 properties below;full MapLibre shaping compatibility is not claimed.

commonPointTextLabels is true;commonTextExternalGlyphDemand is true. Native,WASM main-thread/strict Worker and desktop binding are connected;the mobile host,new desktop text GUI and external platforms remain pending. The complete HTML includes every text control handler. The portable script uses the same API. Points are generated locally;the distribution includes the font license in its third-party notices.

Configurable text typography (08.13)

text-max-width defaults to10em,range0..256;0 disables automatic wrapping while explicit newlines remain. text-line-height defaults to1.2em,range0..256;text-letter-spacing defaults to0em,range-16..256. text-justify accepts center(default),left,right,auto;auto follows the horizontal position of the evaluated text-anchor. text-transform accepts none(default),uppercase,lowercase. Unicode case conversion precedes length and glyph budgeting.

text-size,text-rotate and the three numeric typography properties support common numeric expressions using attributes or zoom. Each evaluated result must be finite and within range. text-padding accepts0..128 constants or numeric expressions. Updates refresh glyph geometry,whole-label collision and queries. Wrapping uses actual glyph advances and keeps whitespace-separated words intact when they fit. Oversized tokens and CJK fall back to character breaks; explicit newlines remain. Complete Unicode line breaking and balanced layout are not claimed. Complex shaping, bidirectional text, remaining rich text types and font files remain pending. Format text sections support different sizes and colors; see formatted text. External PBF glyph services are connected.

map.setLayoutProperty('labels','text-max-width',10);
map.setLayoutProperty('labels','text-line-height',1.5);
map.setLayoutProperty('labels','text-letter-spacing',0.1);
map.setLayoutProperty('labels','text-justify','center');
map.setLayoutProperty('labels','text-transform','uppercase');
map.setLayoutProperty('labels','text-size',['interpolate',['linear'],['zoom'],0,12,10,24]);
await map.sqs.flush({render:true});

Property names,units and defaults reference theMapLibre style specification. Execution and typography use SqsMap's shared core. Legacy label entry points retain their behavior. Thecomplete HTML exampleincludes every button handler. Standalone SDK code uses map.flush;script code uses map.sqs.flush.

Text offset array expressions accept attributes/global-state and semiliteral; existing constants remain valid.

08.36: text-anchor, text-justify and text-transform accept string expressions evaluated per feature from attributes/global state. Drawing, collision and queries share the refreshed layout. Invalid result types/enumerations reject the candidate; layout still rejects feature-state. Text enum guide.